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.|
|name||Points to a character string that contains the host name and the address family in the format: family:host. The value of the family parameter must be ip.|
|port||Points to the socket port number.|
|status||Points to the completion status.|
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;
This Library Routine is part of Network Computing System in Network Support Facilities in Base Operating System (BOS) Runtime.
Remote Procedure Call (RPC) Runtime Library (NCS) in AIX Version 4.3 Communications Programming Concepts.