


getpeername(3)                                     getpeername(3)


NNAAMMEE
       getpeername - get address of connected peer

SSYYNNOOPPSSIISS
       ##iinncclluuddee <<ssyyss//ssoocckkeett..hh>>

   AAFF__UUNNIIXX oonnllyy::
       ##iinncclluuddee <<ssyyss//uunn..hh>>

       iinntt ggeettppeeeerrnnaammee((iinntt ss,, ssttrruucctt ssoocckkaaddddrr **aaddddrr,,
              ssiizzee__tt **aaddddrrlleenn));;

DDEESSCCRRIIPPTTIIOONN
       _s is a socket descriptor.  _g_e_t_p_e_e_r_n_a_m_e returns the address
       of the peer socket connected to the socket indicated by _s.
       _a_d_d_r  points  to  a socket address structure in which this
       address is returned.  _a_d_d_r_l_e_n points to an object of  type
       ssiizzee__tt,  which  should be initialized to indicate the size
       of the address structure.   On  return,  it  contains  the
       actual  size  of the address returned (in bytes).  If _a_d_d_r
       does not point  to  enough  space  to  contain  the  whole
       address  of  the peer, only the first _a_d_d_r_l_e_n bytes of the
       address are returned.

RREETTUURRNN VVAALLUUEE
       If the call is successful, 0 is  returned.   If  the  call
       fails,  -1  is  returned  and  an  error code is stored in
       eerrrrnnoo.

DDIIAAGGNNOOSSTTIICCSS
       _g_e_t_p_e_e_r_n_a_m_e fails if:

       [EBADF]             The argument _s is  not  a  valid  file
                           descriptor.

       [ENOTCONN]          The socket is not connected.

       [EINVAL]            The  socket  has  been shut down.  The
                           argument _s is a file, not a socket.

       [EOPNOTSUPP]        Operation not  supported  for  AF_UNIX
                           sockets.

SSEEEE AALLSSOO
       bind(3), socket(3), getsockname(3).












                             MiNT-Net                           1


