You are here : Csys/socket.hgetpeername

getpeername() - sys/socket.h

The getpeername() function retrieves the peer address of the specified socket, stores this address in the sockaddr structure pointed to by the address argument, and stores the length of this address in the object pointed to by the address_len argument. 


Syntax

int getpeername(int socket, struct sockaddr *address,socklen_t *address_len);


Example


Output / Return Value

Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error. 


Limitations


Alternatives / See Also


Reference

http://pubs.opengroup.org/onlinepubs/7908799/xns/getpeername.html