COHERENT manpages

This page displays the COHERENT manpage for getsockname() [Get the name of a socket].

List of available manpages
Index


getsockname() -- Sockets Function (libsocket)

Get the name of a socket
int getsockname(socket, name, namelen)
int socket, *namelen; struct sockaddr *name;

Function getsockname() returns the current name that is bound to socket.

socket is  a file descriptor that identifies the  socket in question.  name
points  to a  space into  which  getsockname() can  write the  socket name.
namelen points to  an integer that holds the number  of bytes to which name
points.  getsockname()  re-initializes this integer to  the number of bytes
in the name that it writes at address name.

If  all goes  well, getsockname()  returns zero.  If  a problem  occurs, it
returns -1 and sets errno to an appropriate value.  The following lists the
errors that can occur, by the value to which getsockname() sets errno:

EBADF
     socket is not a valid file descriptor.

ENOTSOCK
     socket identifies a file, not a socket.

ENOBUFS
     The system lacks sufficient resources to perform the operation.

EFAULT
     name contains an illegal address.

See Also

bind(),
libsocket,
socket()