Go to the previous, next section.
int getpeername(int s, struct sockaddr *name, int
*namelen);
s: [in] the socket.
name: [out] points to the buffer where to store the name.
namelen: [in out] the maximum length (in bytes) of name.
Returns the name of the peer machine connected to the remote end of a socket. If the buffer is too small, the name is truncated.
On success zero is returned. On error, -1 is returned and errno
is
set to one of the following values:
EBADF
, ENOSOCK
, ENOTCONN
, ENOBUFS
and
EFAULT
.
Go to the previous, next section.