GETSOCKNAME(2)

NAME
getsockname - get the current name/address of a socket.

SYNOPSIS
#include <sys/socket.h>
int getsockname(int sd, struct sockaddr * addr, socklen_t * addr_len);

DESCRIPTION
getsockname() 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 ALSO
socket(2), getpeername(2)