GETSOCKNAME(2) BSD Programmer's Manual GETSOCKNAME(2) NNAAMMEE ggeettssoocckknnaammee - get socket name SSYYNNOOPPSSIISS _i_n_t ggeettssoocckknnaammee(_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 GGeettssoocckknnaammee() returns the current _n_a_m_e for the specified socket. 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). 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. [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 bind(2), socket(2) BBUUGGSS Names bound to sockets in the UNIX domain are inaccessible; getsockname returns a zero length name. HHIISSTTOORRYY The ggeettssoocckknnaammee function call appeared in 4.2BSD. 4.2 Berkeley Distribution June 4, 1993 1