I am porting our RPC software from Linux to QNX and have encountered one problem: the clnt_control() method in the RPC library (sort of an RPC ioctl()) does not seem to be working - at least the CLGET_SERVER_ADDR function.
Refer to the below code fragment:
CLIENT * client; // passed in as a parameter struct sockaddr_in addr; bool status = clnt_control(client, CLGET_SERVER_ADDR, (char *) &addr); in_addr_t ip_addr = addr.sin_addr.s_addr;
On both Linux and QNX the call to clnt_control() returns true.
On our Linux systems this code returns the server IP address in addr.
On our QNX 6.3.2 systems, this code always returns 100.117.0.0 (interpreted as an IP address) in addr.
Any ideas? Is this a bug in the RPC library?
Does anybody have another suggestion on how I can get the server IP address from a CLIENT * ???
Of course I could do a name server lookup from the host name, but I would have to jump through several hoops to make that information available at this point in the code…