ggeettppeeeerrnnaammee() -- Sockets Function (libsocket)

Get name of connected peer
iinntt ggeettppeeeerrnnaammee(_s_o_c_k_e_t, _n_a_m_e, _n_a_m_e_l_e_n)
iinntt _s_o_c_k_e_t, *_n_a_m_e_l_e_n; ssttrruucctt ssoocckkaaddddrr *_n_a_m_e;

ggeettppeeeerrnnaammee() returns the name of the peer connected to _s_o_c_k_e_t.

_n_a_m_e points  to the space into  which ggeettppeeeerrnnaammee() writes the  name of the
peer.  _n_a_m_e_l_e_n points to an integer that gives the amount of space to which
nnaammee points.   ggeettppeeeerrnnaammee() re-initializes it to the  length, in bytes, of
the peer name that it has written at _n_a_m_e.

If  all goes  well, ggeettppeeeerrnnaammee()  returns  zero.  If  an error  occurs, it
returns -1 and sets eerrrrnnoo to an appropriate value.  The following lists the
errors that can occur, by the value to which ggeettppeeeerrnnaammee() sets eerrrrnnoo:

EEBBAADDFF
     _s_o_c_k_e_t is not a valid descriptor.

EENNOOTTSSOOCCKK
     _s_o_c_k_e_t describes a file, not a socket.

EENNOOTTCCOONNNN
     _s_o_c_k_e_t is not connected.

EENNOOBBUUFFSS
     The system lack resources to perform the operation.

EEFFAAUULLTT
     _n_a_m_e contains an illegal address.

_S_e_e _A_l_s_o
aacccceepptt(), bbiinndd(), ggeettssoocckknnaammee(), lliibbssoocckkeett, ssoocckkeett()
