NAME | SYNOPSIS | API RESTRICTIONS | FEATURES | DESCRIPTION | RETURN VALUE | ATTRIBUTES | SEE ALSO
#include <sys/types.h> #include <sys/socket.h>int getpeername(int s, struct sockaddr *name, int *namelen);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
POSIX_SOCKETS
The getpeername function returns the name of the peer connected to socket s. 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.
Upon successful completion, getpeername returns 0; otherwise it returns -1 and sets errno to indicate one of the following error conditions:
The s argument is not a valid descriptor.
The s argument is a file, not a socket.
The socket is not connected.
Insufficient resources were available within the system to perform the operation.
The name parameter points to memory which is not in a valid part of the process's address space.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
MT-level |
MT-safe |
NAME | SYNOPSIS | API RESTRICTIONS | FEATURES | DESCRIPTION | RETURN VALUE | ATTRIBUTES | SEE ALSO