name_open() vs. qnx_name_locate()

In QNX4, to make a connection to a server one called qnx_name_locate()
which returned the PID of the server to which you were connecting. We
have a lot of QNX4 code we’ve ported over to QNX6. Under QNX6 we call
name_open() instead. This works without problems but, instead of the
server’s process ID, name_open() returns a connection ID. For the
purposes of message passing we don’t really care but our QNX4 clients
used to report the PID of the server they were connected to in their
log messages and I would still like to be able to do that.

Is there a function that I can stick in a client that can take the
connection ID returned from name_open() and return the PID of the
server to which it is connected? I know for instance that on the
server side, MsgInfo() can be used with the rcvid returned from
MsgReceive() to get the PID of the sending client. I figure there
must be something similar that will get me the PID of the server from
the client side.

Any help would be appreciated


Regards,


Charlie Hubbard

<charles.hubbard@pnl.gov> wrote in message
news:b5ogu0l6nvsfc054lbl7hki5lr0kvrlsbo@4ax.com

Is there a function that I can stick in a client that can take the
connection ID returned from name_open() and return the PID of the
server to which it is connected? I know for instance that on the
server side, MsgInfo() can be used with the rcvid returned from
MsgReceive() to get the PID of the sending client. I figure there
must be something similar that will get me the PID of the server from
the client side.

ConnectServerInfo()

On Fri, 14 Jan 2005 19:47:47 -0500, “Wojtek Lerch” <Wojtek_L@yahoo.ca>
wrote:

charles.hubbard@pnl.gov> > wrote in message
news:> b5ogu0l6nvsfc054lbl7hki5lr0kvrlsbo@4ax.com> …
Is there a function that I can stick in a client that can take the
connection ID returned from name_open() and return the PID of the
server to which it is connected? I know for instance that on the
server side, MsgInfo() can be used with the rcvid returned from
MsgReceive() to get the PID of the sending client. I figure there
must be something similar that will get me the PID of the server from
the client side.

ConnectServerInfo()

Thank you for the quick response. ConnectServerInfo() looks like
it’ll do the trick.

I’ve read through the documentation for ConnectServerInfo() and there
is one point I’m still confused about. The prototype is:

ConnectServerInfo(pid_t pid, int coid, struct _server_info *info);

I take it ‘coid’ is the value returned from name_open() and ‘info’ is
a pointer to a buffer in which the result will be returned. What
value do I put in for ‘pid’? Is that the client’s PID as returned by
a call to getpid()?


Charlie Hubbard

charles.hubbard@pnl.gov wrote:

ConnectServerInfo(pid_t pid, int coid, struct _server_info *info);

I take it ‘coid’ is the value returned from name_open() and ‘info’ is
a pointer to a buffer in which the result will be returned. What
value do I put in for ‘pid’? Is that the client’s PID as returned by
a call to getpid()?

Yes. In general, the pid of the process that created the connection
(perhaps by calling name_open()). If you’re calling ConnectServerInfo()
from the same process, zero insted of its pid works, too (but for some
reason is undocumented).

On Mon, 17 Jan 2005 13:53:27 -0500, Wojtek Lerch <Wojtek_L@yahoo.ca>
wrote:

charles.hubbard@pnl.gov > wrote:
ConnectServerInfo(pid_t pid, int coid, struct _server_info *info);

I take it ‘coid’ is the value returned from name_open() and ‘info’ is
a pointer to a buffer in which the result will be returned. What
value do I put in for ‘pid’? Is that the client’s PID as returned by
a call to getpid()?

Yes. In general, the pid of the process that created the connection
(perhaps by calling name_open()). If you’re calling ConnectServerInfo()
from the same process, zero insted of its pid works, too (but for some
reason is undocumented).

Thanks. Works great!