sending messages

I have a two processes which would like to send messages to each other.
But in order to send messages to another process you need to know the
pid and cid of the process who owns the channel. How can I get this information from another process?

ie. processA has created the channel, now processB needs to ConnectAttach() but doesn’t know anything about processA (pid,cid etc…)

using “name_attach” from server and using “name_open” in the client seems to be one solution but is there any other solution?

  • Store the info in share memory
  • Turn process in to resgmr and use open().
  • Use named pipe.

why do you not use named pipe ?

is using named pipe in QNX mean creating FIFO where one process will write and the other read?
So in general the solution is either make it a resource manager or use some type of shared memory location to pass this information?

  • Use mqueue

ok thanks

I have to ask - what is wrong with name_attach()/name_open()

If you’re using mqueue or named pipes you are having THEM do it for you, and now your messages are send through a third party server.

Unless you require buffering, I can’t think of a good reason (off the top of my head) not to manage the name yourself.

yes, i do require buffering where name_attach/name_open is good for sending messages to small number of processes where you know them by name, but when a process wants to send a message to many processes, it becomes very tedious to name_open all their names.