BIND(2)             Linux Programmer's Manual             BIND(2)


NAME
       bind - bind a name to a socket

SYNOPSIS
       #include (lt)sys/types.h(gt)
       #include (lt)sys/socket.h(gt)

       int   bind(int   sockfd,  struct  sockaddr  *my_addr,  int
       addrlen);

DESCRIPTION
       bind gives the socket, sockfd, the local address  my_addr.
       my_addr  is  addrlen  bytes  long.  Traditionally, this is
       called "assigning a name to a socket" (when  a  socket  is
       created with socket(2), it exists in a name space (address
       family) but has no name assigned.)

NOTES
       Binding a name in the UNIX domain creates a socket in  the
       file  system that must be deleted by the caller when it is
       no longer needed (using unlink(2)).

       The rules used in name binding vary between  communication
       domains.   Consult  the  manual  entries  in section 4 for
       detailed information.

RETURN VALUE
       On success, zero is returned.  On error, -1  is  returned,
       and errno is set appropriately.

ERRORS
       EBADF   sockfd is not a valid descriptor.

       EINVAL  The  socket  is already bound to an address.  This
               may change in the  future:  see  linux/unix/sock.c
               for details.

       EACCES  The  address is protected, and the user is not the
               super-user.

       ENOTSOCK
               Argument is a descriptor for a file, not a socket.

       The following errors are specific to UNIX domain (AF_UNIX)
       sockets:

       EINVAL  The addr_len was wrong, or the socket was  not  in
               the AF_UNIX family.

       EROFS   The  socket inode would reside on a read-only file
               system.

       EFAULT  my_addr points  outside  your  accessible  address
               space.



Linux 0.99.11              23 July 1993                         1





BIND(2)             Linux Programmer's Manual             BIND(2)


       ENAMETOOLONG
               my_addr is too long.

       ENOENT  The file does not exist.

       ENOMEM  Insufficient kernel memory was available.

       ENOTDIR A component of the path prefix is not a directory.

       EACCES  Search permission is denied on a component of  the
               path prefix.

       ELOOP   my_addr contains a circular reference (i.e., via a
               symbolic link)

CONFORMING TO
       SVr4, 4.4BSD (the bind  function  first  appeared  in  BSD
       4.2).   SVr4  documents  additional EADDRNOTAVAIL, EADDRI-
       NUSE, ENOSR general error conditions, and additional  EIO,
       EISDIR and EROFS Unix-domain error conditions.

SEE ALSO
       accept(2),   connect(2),  listen(2),  socket(2),  getsock-
       name(2)

































Linux 0.99.11              23 July 1993                         2



Please look at the man2html translation issues.
man2html.pl Version 1.1, Copyright 1997, 1998 by Richard Dawe