GETSOCKNAME(2)
NAME
getsockname − get socket name
USAGE
getsockname(s, name, namelen) int s, namelen; struct sockaddr *name;
DESCRIPTION
Getsockname returns the current name for the specified socket s. The namelen parameter should be initialized to indicate the amount of space that name points to. On return, it contains the size, in bytes, of the name.
RETURN VALUE
A successful call returns zero. A failed call returns -1 and sets errno as indicated below.
ERRORS
The call succeeds unless:
[EBADF] The argument s is not a valid descriptor.
[ENOTSOCK] The argument s is a file, not a socket.
[ENOBUFS] Insufficient system resources were available.
[EFAULT] The name parameter points to memory that isn’t in a valid part of the process’s address space.