getsockname(2) — 4 BSD
NAME
getsockname − get socket name
SYNOPSIS
int getsockname (s, name, namelen)
int s;
struct sockaddr ∗name;
int ∗namelen;
DESCRIPTION
getsockname 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 VALUE
If the calls succeed, a value of 0 is returned. If an error occurs, the value −1 is returned, and a more precise error code is placed in the global variable errno.
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 resources were available in the system to perform the operation.
[EFAULT] The name parameter points to memory not in a valid part of the process address space.
NOTE
This call is defined in the 88open Binary and Object Compatibility Standards’ Networking Supplements (BCSNS and OCSNS) for use in BCSNS/OCSNS compliant applications. OCSNS-defined functions may be accessed by passing OCS options to cc(1) and ld(1).
SEE ALSO
CX/UX Programmer’s Reference Manual