View topic - repeatedly message passing

repeatedly message passing

anything that doesn't fit to other groups.

repeatedly message passing

Postby digital_turtle » Mon Dec 12, 2016 4:56 am


i'm a QNX 6.5 sp1 users, need some advice for my project..
i'm doing message passing across several process..
in server side, i used msg_receive() in an infinite loop..
in client side, i used name_open(), msg_send(), and name_close() also in infinite loop..
im concerning the client side :

client program :

for (;;) {
pid = name_open("servername",NULL);

message passing was executed normally and no problem..
but i noticed that the pid in client side is increasing in each loop.. is this normal?

thank you
New Member
Posts: 1
Joined: Wed Oct 19, 2016 4:15 am

Re: repeatedly message passing

Postby maschoen » Tue Dec 13, 2016 3:58 am

The return from name_locate() is not a process id, but rather a connection-id. Since you keep creating it and destroying it, it increments. There is not reason to do this over and over unless your server is transient or if it will get recreated if it dies. The overhead is not necessary. If you are concerned about your server dying and being recreated, you can check whether the MsgSend worked. If it fails, run name_locate() again. If name_locate() fails, your server is gone.
QNX Master
Posts: 2720
Joined: Wed Jun 25, 2003 5:18 pm

Return to General Programming

Who is online

Users browsing this forum: No registered users and 2 guests