getpeername TCP UDP
Returns the address of the peer connected on a socket.
Files
net_bsd.h/net_bsd.c
Prototype
int getpeername ( int sock_id, struct sockaddr *addr, socklen_t *addrlen);
Arguments
sock_id
Socket whose peer name will get returned.
addr
Pointer to a struct sockaddr instance that will be populated with the peer's info.
len
Pointer to a socklen_t variable that will get the length of the peer's address.
Returned Value
0, if no error.
-1, otherwise.