GETSOCKNAME(2)GETSOCKNAME(2)NAMEgetsockname - get the current name/address of a socket.
SYNOPSIS
#include <sys/socket.h>
int getsockname(int sd, struct sockaddr * addr, socklen_t * addr_len);
DESCRIPTIONgetsockname() takes a connected socket sd and fills in addr with the
name/address of the socket.
RETURN VALUES
On success, this function returns 0. On error, -1 is returned and errno
is set.
ERRORS
[ENOSYS] The operation is not implemented for the given socket.
[EINVAL] The socket does not have a name/address.
SEE ALSOsocket(2), getpeername(2)GETSOCKNAME(2)