TCP/IP Programming Manual
address_len_ptr
input and return value; maintained only for compatibility and should point to a value indicating
the size in bytes of the structure (the remote address and port number) pointed to by
address_ptr.
tag
input value; the tag parameter to be used for the nowait operation initiated by
getpeername_nw.
Errors
If an error occurs, the external variable errno is set to one of the following values:
The specified socket was not connected.ENOTCONN
One of the specified arguments was invalid.EINVAL
Usage Guidelines
• Use getpeername on a socket created for waited operations, or getpeername_nw on a
socket created for nowait operations. The operation initiated by getpeername_nw must be
completed with a call to the AWAITIOX procedure.
• Complete the operation initiated by getpeername_nw must be with a call to the Guardian
AWAITIOX procedure.
• If an unconnected socket is specified in a call to either the getpeername or
getpeername_nw, the function fails. This is typical of socket implementations.
• Declare the address_ptr variable as struct sockaddr_in6 * for IPv6 use or as
struct sockaddr_storage * for protocol-independent use. In C, when you make the
call, cast the variable to sockaddr. (See the IPv6 example.)
See Nowait Call Errors (page 86) for information on error checking.
See Data Structures (page 63) for information about struct sockaddr *.
getprotobyname
The getprotobyname function gets the protocol number of the protocol with the specified name.
C Synopsis
#include <netdb.h>
proto_entry_ptr = getprotobyname (proto_name_ptr);
struct protoent *proto_entry_ptr;
char *proto_name_ptr;
TAL Synopsis
?NOLIST, SOURCE SOCKDEFT
?NOLIST, SOURCE SOCKPROC
proto_entry_ptr := getprotobyname (proto_name_ptr);
INT(32) proto_entry_ptr;
STRING .EXT proto_name_ptr;
proto_entry_ptr
return value; points to a structure (based on the protoent structure) that contains all the
information available about the specified protocol. This is the return value.
If the lookup fails, NULL is returned.
122 Library Routines