2 clients and one server problem

QNX 6.1.A

I have three processes, 2 clients and a server.

Client 1:
ChannelCreate()
ConnectAttach()
name_open(server_name)
MsgSend()

Server:
name_attach()
MsgReceive()

Client 2:
name_open(server_name)
MsgSend()

This works fine (ie both clients can send messages to the server) until
client 2 exits. I would like to still be able to send messages from client
1 to the server and perhaps start client 2 up again later. However as soon
as client 2 exits the server MsgReceive() fails with an errno of EFAULT
(14). I have tried using name_close() in client 2 but I can’t stop this
error occurring. Is there anyway to achieve this functionality?

Paul

Paul Jones <paul.jones@bnc.ox.ac.uk> wrote:

QNX 6.1.A

I have three processes, 2 clients and a server.

Client 1:
ChannelCreate()
ConnectAttach()
name_open(server_name)
MsgSend()

Server:
name_attach()
MsgReceive()

Client 2:
name_open(server_name)
MsgSend()

This works fine (ie both clients can send messages to the server) until
client 2 exits. I would like to still be able to send messages from client
1 to the server and perhaps start client 2 up again later. However as soon
as client 2 exits the server MsgReceive() fails with an errno of EFAULT
(14). I have tried using name_close() in client 2 but I can’t stop this
error occurring. Is there anyway to achieve this functionality?

How big is your receive buffer on the server side? Is it at least as
big as a struct _pulse (about 32 bytes)?

You will get, among other things, a disconnect pulse when any client using
the name_open()/name_attach() methodology goes away, and if your receive
buffer isn’t big enough for a struct _pulse, your MsgReceive() will return
EFAULT because the kernel tried to write a too large amount of data into
your too small buffer (and the pulse will get discarded). You should find
that if you continue operating after this error, that you will continue to
receive your messages from client 1. BUT, the proper way to handle this,
is to prepare for the pulses, and handle them.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.