TEXT   14

bind.txt

Guest on 1st August 2021 05:50:07 PM

  1. NAME
  2.        bind - bind a name to a socket
  3.  
  4.  
  5.  
  6. SYNOPSIS
  7.        #include <sys/types.h>
  8.        #include <sys/socket.h>
  9.  
  10.        int   bind(int   sockfd,  struct  sockaddr  *my_addr,  int
  11.        addrlen);
  12.  
  13.  
  14.  
  15. DESCRIPTION
  16.        bind gives the socket, sockfd, the local address  my_addr.
  17.        my_addr  is  addrlen  bytes  long.  Traditionally, this is
  18.        called "assigning a name to a socket" (when  a  socket  is
  19.        created with socket(2), it exists in a name space (address
  20.        family) but has no name assigned.)
  21.  
  22.  
  23.  
  24. NOTES
  25.        Binding a name in the UNIX domain creates a socket in  the
  26.        file  system that must be deleted by the caller when it is
  27.        no longer needed (using unlink(2)).
  28.  
  29.        The rules used in name binding vary between  communication
  30.        domains.   Consult  the  manual  entries  in section 4 for
  31.        detailed information.
  32.  
  33.  
  34.  
  35. RETURN VALUE
  36.        On success, zero is returned.  On error, -1  is  returned,
  37.        and errno is set appropriately.
  38.  
  39.  
  40.  
  41. ERRORS
  42.        EBADF   sockfd is not a valid descriptor.
  43.  
  44.        EINVAL  The  socket  is already bound to an address.  This
  45.                may change in the  future:  see  linux/unix/sock.c
  46.                for details.
  47.  
  48.        EACCES  The  address is protected, and the user is not the
  49.                super-user.
  50.  
  51.        The following errors are specific to UNIX domain (AF_UNIX)
  52.        sockets:
  53.  
  54.        EINVAL  The  addr_len  was wrong, or the socket was not in
  55.                the AF_UNIX family.
  56.  
  57.        EROFS   The socket inode would reside on a read-only  file
  58.                system.
  59.  
  60.        EFAULT  my_addr  points  outside  your  accessible address
  61.                space.
  62.  
  63.        ENAMETOOLONG
  64.                my_addr is too long.
  65.  
  66.        ENOENT  The file does not exist.
  67.  
  68.        ENOMEM  Insufficient kernel memory was available.
  69.  
  70.        ENOTDIR A component of the path prefix is not a directory.
  71.  
  72.        EACCES  Search  permission is denied on a component of the
  73.                path prefix.
  74.  
  75.        ELOOP   my_addr contains a circular reference (i.e., via a
  76.                symbolic link)
  77.  
  78.  
  79.  
  80. HISTORY
  81.        The bind function call appeared in BSD 4.2.
  82.  
  83.  
  84.  
  85. SEE ALSO
  86.        accept(2),   connect(2),  listen(2),  socket(2),  getsock-
  87.        name(2)

Raw Paste


Login or Register to edit or fork this paste. It's free.