TCP/IP Programming Manual

Errors
No errors are returned for this function.
Usage Guidelines
This call requires the presence of a NETWORKS file providing information on the networks
accessible from this host. The format of this file is described in the TCP/IPv6 Configuration
and Management Manual.
The parameters passed to the getnetbyname function are case-sensitive.
The netent structure is statically declared. Subsequent calls to getnetbyname replace the
existing data in the netent structure.
getpeername, getpeername_nw
The getpeername and getpeername_nw functions get the address and port number of the
remote host to which the specified socket is connected.
C Synopsis
#include <socket.h>
#include <in.h>
#include <in6.h> /* for IPv6 use */
#include <netdb.h>
error = getpeername (socket, address_ptr, address_len_ptr);
error = getpeername_nw (socket, address_ptr,
address_len_ptr, tag);
int error, socket, *address_len_ptr;
struct sockaddr *address_ptr;
long tag;
TAL Synopsis
?NOLIST, SOURCE SOCKDEFT
?NOLIST, SOURCE SOCKPROC
error := getpeername (socket, address_ptr, address_len_ptr);
error := getpeername_nw (socket, address_ptr,
address_len_ptr, tag);
INT(32) socket,
.EXT address_len_ptr,
.EXT address_ptr (sockaddr_in);
INT(32) tag;
error
return value; if the call is successful, a zero is returned. If the call is not successful, —1 is
returned. If the call failed, the external variable errno is set as indicated in Errors (page 122).
socket
input value; specifies the socket number for the socket, as returned by the call to socket or
socket_nw.
address_ptr
input and return value; points, on return, to the address and port number of the remote socket
to which this socket is connected.
getpeername, getpeername_nw 121