getpeername - get name of connected peer
#include <sys/socket.h>
getpeername() returns the name of the peer connected to socket s . The int pointed to by the namelen parameter should be initialized to indicate the amount of space pointed to by name . On return it contains the actual size of the name returned (in bytes). The name is truncated if the buffer provided is too small.
If successful, getpeername() returns 0; otherwise it returns -1 and sets errno to indicate the error.
This function is a member of Unison's IOLIB family of functions. IOLIB is implemented as a message passing and generalized interface layer. Each Unison I/O server is responsible for its own error reporting.
For an exact list of error codes returned by a particular server, refer to that server's documentation in the Unison Programmer's Guide for each specific platform.
Servers may implement these errors codes in response to this function.
The call succeeds unless:
accept(), bind(), getsockname(), socket()