NAME
|
NAME
|
getpeername - get name of connected peer
|
getpeername - get name of connected peer
|
|
|
SYNOPSIS
|
SYNOPSIS
|
#include <network.h>
|
#include <network.h>
|
|
|
int getpeername(int s, struct sockaddr *name, socklen_t
|
int getpeername(int s, struct sockaddr *name, socklen_t
|
*namelen);
|
*namelen);
|
|
|
DESCRIPTION
|
DESCRIPTION
|
Getpeername returns the name of the peer connected to
|
Getpeername returns the name of the peer connected to
|
socket s. The namelen parameter should be initialized to
|
socket s. The namelen parameter should be initialized to
|
indicate the amount of space pointed to by name. On
|
indicate the amount of space pointed to by name. On
|
return it contains the actual size of the name returned
|
return it contains the actual size of the name returned
|
(in bytes). The name is truncated if the buffer provided
|
(in bytes). The name is truncated if the buffer provided
|
is too small.
|
is too small.
|
|
|
RETURN VALUE
|
RETURN VALUE
|
On success, zero is returned. On error, -1 is returned,
|
On success, zero is returned. On error, -1 is returned,
|
and errno is set appropriately.
|
and errno is set appropriately.
|
|
|
ERRORS
|
ERRORS
|
EBADF The argument s is not a valid descriptor.
|
EBADF The argument s is not a valid descriptor.
|
|
|
ENOTSOCK
|
ENOTSOCK
|
The argument s is a file, not a socket.
|
The argument s is a file, not a socket.
|
|
|
ENOTCONN
|
ENOTCONN
|
The socket is not connected.
|
The socket is not connected.
|
|
|
ENOBUFS Insufficient resources were available in the sys-
|
ENOBUFS Insufficient resources were available in the sys-
|
tem to perform the operation.
|
tem to perform the operation.
|
|
|
|
|
|
|