Inter-process communication

I am new to QNX 6.3. I am trying to use MsgSend and MsgReceive to
communicate between 2 processes. If the receiver uses ChannelCreate to
create a channel ID , then how does the sender know what the channel ID is?

I used ConnectAttach() in the sender, but then this returns an error. Can
someone describe how connectattch should be used?

Thanks
Shashank

Shashank <sbalijepalli@precitech.com> wrote:

I am new to QNX 6.3. I am trying to use MsgSend and MsgReceive to
communicate between 2 processes. If the receiver uses ChannelCreate to
create a channel ID , then how does the sender know what the channel ID is?

I used ConnectAttach() in the sender, but then this returns an error. Can
someone describe how connectattch should be used?

Usually the receiver would use name_attach() to create a channel and
associate a name with it, and the sender would use name_open() to locate
that name and create a connection to it.

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com

The interesting thing about name_attach is that it does not provide the
connection Id in the name_attach_t structure. So, how could you use the
named channel for receiving messages from both other processes and from
threads within your process? In other words, you need the connection Id to
be able to send a pulse or message, and it is returned by ConnectAttach, but
not available if you use name_attach. So the “server” process (ie. the one
that calls name_attach) apparently can’t use that channel for receiving
messages from its threads. Right? Any suggestions?

Thanks,

Halden

“David Gibbs” <dagibbs@qnx.com> wrote in message
news:d29lou$c56$1@inn.qnx.com

Shashank <> sbalijepalli@precitech.com> > wrote:

I am new to QNX 6.3. I am trying to use MsgSend and MsgReceive to
communicate between 2 processes. If the receiver uses ChannelCreate to
create a channel ID , then how does the sender know what the channel ID
is?

I used ConnectAttach() in the sender, but then this returns an error. Can
someone describe how connectattch should be used?

Usually the receiver would use name_attach() to create a channel and
associate a name with it, and the sender would use name_open() to locate
that name and create a connection to it.

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com

“Halden” <ricanz58@yahoo.com> wrote in message
news:d49hac$oun$1@inn.qnx.com

The interesting thing about name_attach is that it does not provide the
connection Id in the name_attach_t structure. So, how could you use the
named channel for receiving messages from both other processes and from
threads within your process? In other words, you need the connection Id
to be able to send a pulse or message, and it is returned by
ConnectAttach, but not available if you use name_attach. So the “server”
process (ie. the one that calls name_attach) apparently can’t use that
channel for receiving messages from its threads. Right? Any suggestions?

Have the threads call name_open(), the value return by name_open is the cid.


Thanks,

Halden

“David Gibbs” <> dagibbs@qnx.com> > wrote in message
news:d29lou$c56$> 1@inn.qnx.com> …
Shashank <> sbalijepalli@precitech.com> > wrote:

I am new to QNX 6.3. I am trying to use MsgSend and MsgReceive to
communicate between 2 processes. If the receiver uses ChannelCreate to
create a channel ID , then how does the sender know what the channel ID
is?

I used ConnectAttach() in the sender, but then this returns an error.
Can
someone describe how connectattch should be used?

Usually the receiver would use name_attach() to create a channel and
associate a name with it, and the sender would use name_open() to locate
that name and create a connection to it.

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com

Halden <ricanz58@yahoo.com> wrote:

The interesting thing about name_attach is that it does not provide the
connection Id in the name_attach_t structure. So, how could you use the
named channel for receiving messages from both other processes and from
threads within your process? In other words, you need the connection Id to
be able to send a pulse or message, and it is returned by ConnectAttach, but
not available if you use name_attach. So the “server” process (ie. the one
that calls name_attach) apparently can’t use that channel for receiving
messages from its threads. Right? Any suggestions?

name_attach() JUST gives you a channel. It does NOT give you a connection
id, therefor there is no coid to export in the name_attach_t structure.
name_attach() is the replacement for (sits on top of) ChannelCreate().
name_open() the replacement for ConnectAttach().

If you want threads in the same process to send to your channel,

name_attach_t *att;

att = name_attach(…);
self_coid = ConnectAttach( att->chid, … , _NTO_SIDE_CHANNEL, … );

-David

Thanks,

Halden

“David Gibbs” <> dagibbs@qnx.com> > wrote in message
news:d29lou$c56$> 1@inn.qnx.com> …
Shashank <> sbalijepalli@precitech.com> > wrote:

I am new to QNX 6.3. I am trying to use MsgSend and MsgReceive to
communicate between 2 processes. If the receiver uses ChannelCreate to
create a channel ID , then how does the sender know what the channel ID
is?

I used ConnectAttach() in the sender, but then this returns an error. Can
someone describe how connectattch should be used?

Usually the receiver would use name_attach() to create a channel and
associate a name with it, and the sender would use name_open() to locate
that name and create a connection to it.

-David

David Gibbs
QNX Training Services
dagibbs@qnx.com


David Gibbs
QNX Training Services
dagibbs@qnx.com

Shashank wrote:

I am new to QNX 6.3. I am trying to use MsgSend and MsgReceive to
communicate between 2 processes. If the receiver uses ChannelCreate to
create a channel ID , then how does the sender know what the channel ID is?

I used ConnectAttach() in the sender, but then this returns an error. Can
someone describe how connectattch should be used?

We bypassed the whole problem by writing our own name server and wrapper
API that is code-compatible across QNX4, QNX6 and Linux. In QNX4 and
QNX6 it is also network aware, so you can find processes on other nodes
transparently. It also emits messages to other participating processes
whenever a process starts or stops (really, whenever a process declares
or deletes a name) in all operating systems. Try looking at the “Cogent
API” and the enclosed code examples at http://www.cogent.ca

Cheers,
Andrew