Preliminary: | MT-Safe | AS-Safe | AC-Safe | See POSIX Safety Concepts.
getpeernamefunction returns the address of the socket that socket is connected to; it stores the address in the memory space specified by addr and length-ptr. It stores the length of the address in
See Socket Addresses, for information about the format of the address. In some operating systems,
getpeernameworks only for sockets in the Internet domain.
The return value is
0on success and
-1on error. The following
errnoerror conditions are defined for this function:
- The argument socket is not a valid file descriptor.
- The descriptor socket is not a socket.
- The socket socket is not connected.
- There are not enough internal buffers available.