Index of Section 2 Manual Pages
| Interix / SUA | getsockname.2 | Interix / SUA |
getsockname(2) getsockname(2)
getsockname()
NAME
getsockname() - get socket name
SYNOPSIS
int getsockname (int s, struct sockaddr *name, int *namelen)
DESCRIPTION
The getsockname(2) function returns the current name for the specified
socket. The namelen parameter should be initialized to indicate the amount
of space pointed to by name. On return it contains the actual size of the
name returned (in bytes).
RETURN VALUES
If the call succeeds, it returns 0. If it fails, it returns -1 and sets
errno to indicate the error.
ERRORS
The call succeeds unless:
[EBADF]
The argument s is not a valid descriptor.
[EFAULT]
The name parameter points to memory not in a valid part of the process
address space.
[EINVAL]
The socket s has not been bound. The call to bind(2) must succeed
before getsockname(2) can be called successfully.
[ENOTSOCK]
The argument s is a file, not a socket.
[ENOBUFS]
Insufficient resources were available in the system to perform the
operation.
[EOPNOTSUP]
The operation was not supported on this socket type.
SEE ALSO
bind(2)
socket(2)
USAGE NOTES
The getsockname function is thread safe.
The getsockname function is async-signal safe.