4.4BSD/usr/share/man/cat2/getpeername.0
GETPEERNAME(2) BSD Programmer's Manual GETPEERNAME(2)
NNAAMMEE
ggeettppeeeerrnnaammee - get name of connected peer
SSYYNNOOPPSSIISS
_i_n_t
ggeettppeeeerrnnaammee(_i_n_t _s, _s_t_r_u_c_t _s_o_c_k_a_d_d_r _*_n_a_m_e, _i_n_t _*_n_a_m_e_l_e_n);
DDEESSCCRRIIPPTTIIOONN
GGeettppeeeerrnnaammee() returns the name of the peer connected to socket _s. The
_n_a_m_e_l_e_n parameter should be initialized to indicate the amount of space
pointed to by _n_a_m_e. On return it contains the actual size of the name re-
turned (in bytes). The name is truncated if the buffer provided is too
small.
DDIIAAGGNNOOSSTTIICCSS
A 0 is returned if the call succeeds, -1 if it fails.
EERRRROORRSS
The call succeeds unless:
[EBADF] The argument _s is not a valid descriptor.
[ENOTSOCK] The argument _s is a file, not a socket.
[ENOTCONN] The socket is not connected.
[ENOBUFS] Insufficient resources were available in the system to per-
form the operation.
[EFAULT] The _n_a_m_e parameter points to memory not in a valid part of
the process address space.
SSEEEE AALLSSOO
accept(2), bind(2), socket(2), getsockname(2)
HHIISSTTOORRYY
The ggeettppeeeerrnnaammee function call appeared in 4.2BSD.
4.2 Berkeley Distribution June 4, 1993 1