


bind(3)                                                   bind(3)


NNAAMMEE
       bind - bind an address to a socket

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

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

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

DDEESSCCRRIIPPTTIIOONN
       _b_i_n_d  assigns  an  address  to  an unbound socket.  When a
       socket is created with _s_o_c_k_e_t(3), it exists in an  address
       space  (address family) but has no address assigned.  _b_i_n_d
       causes the socket whose descriptor is _s to become bound to
       the  address  specified  in  the  socket address structure
       pointed to by _a_d_d_r.

       _a_d_d_r_l_e_n must specify the size of  the  address  structure.
       Since  the  size  of  the  socket address structure varies
       between  socket  address  families,  the  correct   socket
       address  structure should be used with each address family
       (for example, ssttrruucctt ssoocckkaaddddrr__uunn for AF_UNIX).  Typically,
       the _s_i_z_e_o_f function is used to pass this value in the _b_i_n_d
       call (for example, ssiizzeeooff((ssttrruucctt ssoocckkaaddddrr__uunn))).

       The rules used in address binding vary between  communica-
       tion domains.  For example, when binding an AF_UNIX socket
       to a path name (such as //ttmmpp//mmyyssoocckkeett), an open file  hav-
       ing  that  name  is  created in the file system.  When the
       bound socket is closed, that file still exists  unless  it
       is removed or unlinked.

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

DDIIAAGGNNOOSSTTIICCSS
       _b_i_n_d fails if:

       [EBADF]                  _s is not a valid descriptor.

       [EADDRINUSE]             The  specified address is already
                                in use.

       [EINVAL]                 The socket is already bound to an
                                address, the socket has been shut
                                down or _a_d_d_r_l_e_n is a  bad  value.
                                _s is not a socket.

       [EAFNOSUPPORT]           Requested  address does not match
                                the  address   family   of   this



                             MiNT-Net                           1





bind(3)                                                   bind(3)


                                socket.

       [EACCES]                 The  user has no write permission
                                for the directory containing  the
                                socket file. (AF_UNIX only.)

       [EDESTADDRREQ]           No  _a_d_d_r parameter was specified.

SSEEEE AALLSSOO
       connect(3), getsockname(3), listen(3), socket(3).















































                             MiNT-Net                           2


