repeatedly message passing

hello…

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 (;:wink: {

pid = name_open(“servername”,NULL);
MsgSend(pid,&msg,sizeof(msg),reply,sizeof(reply));
name_close(pid);

}

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

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.