In QNX, how to manage IPC connections between server and client?

723 views Asked by At

Originally I titled the question as "In QNX, what is the difference between _PULSE_CODE_DISCONNECT and _PULSE_CODE_COIDDEATH?". However, I think my question is a little broader than that.

I have implemented an IPC server using the QNX Neutrino OS 6.6.0. Essentially I have a server that is queried for configuration information like settings and stuff. It also accepts changes to settings. It allows for clients to subscribe to it. This means that once subscribed, if a change happens to a setting, the server will notify those other clients.

So far so good. This stuff up to this point makes sense to me. What is not clear to me is the appropriate way to handle a client disconnecting or a process dying.

Right now, I'm receiving a _PULSE_CODE_DISCONNECT on my server. What exactly does that mean? I'm not receiving a _PULSE_CODE_COIDDEATH, which is what I was expecting.

I think in particular I'm a little confused on what a coid vs a scoid is in QNX.

1

There are 1 answers

2
ozzylee On

Receiving _PULSE_CODE_COIDDEATH is dependent upon the flags you set when creating the channel. To get that pulse you need to set the channel flag _NTO_CHF_COID_DISCONNECT.

The _PULSE_CODE_DISCONNECT relates to the channel flag _NTO_CHF_DISCONNECT, to receive the pulse when all connections are detached.

See the documentation for the ChannelCreate: http://www.qnx.com/developers/docs/6.6.0_anm11_wf10/index.html#com.qnx.doc.neutrino.lib_ref/topic/c/channelcreate.html

A coid is a connection id given to you when you connect to a channel via ConnectAttach. scoid is a server connection id (assigned internally) which you get in the pulse you are talking about. In the message receive and reply context it is for the kernel to route the reply to the client.

Also, my understanding is that if you get the _PULSE_CODE_COIDDEATH you need to cleanup by calling ConnectDetach(scoid) where scoid is from the pulse.