Converts a socket address to a host name and port number.
void rpc_$sockaddr_to_name ( sockaddr, slength, name, nlength, port, status)
socket_$addr_t *sockaddr;
unsigned long slength;
unsigned long *nlength;
char *name;
unsigned long *port;
status_$t *status;
The rpc_$sockaddr_to_name routine provides the address family, the host name, and the port number identified by the specified socket address.
sockaddr | Points to a socket address. |
slength | Specifies the length, in bytes, of socket address (sockaddr) parameter. |
nlength | On input, points to the length of the name parameter in the buffer. On output, points to the number of characters returned in the name parameter. |
To take the bank server's socket address, return the server's host name and port, and then print the information, enter:
rpc_$sockaddr_to_name(&saddr, slen, name, &namelen, &port, &st); printf("(bankd) name=\"%.*s\", port=%d\n", name, namelen, port;
Remote Procedure Call (RPC) Runtime Library (NCS) in AIX 5L Version 5.2 Communications Programming Concepts.