![]() |
![]() |
![]() |
Get the name of the peer connected to a socket
#include <sys/socket.h> int getpeername( int s, struct sockaddr * name, size_t * namelen );
libsocket
The getpeername() function returns the name of the peer connected to socket s. You should initialize the namelen parameter to indicate the amount of space pointed to by name. On return, namelen contains the actual size of the name (in bytes). The name is truncated if the buffer provided is too small.
Standard Unix, POSIX 1003.1g (draft)
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
accept(), bind(), getsockname(), socket()
![]() |
![]() |
![]() |