TEXT   221

connect.txt

Guest on 1st August 2021 05:54:37 PM

  1.  
  2.  
  3. NAME
  4.        connect - initiate a connection on a socket
  5.  
  6.  
  7.  
  8. SYNOPSIS
  9.        #include <sys/types.h>
  10.        #include <sys/socket.h>
  11.  
  12.        int  connect(int  sockfd, struct sockaddr *serv_addr, int
  13.        addrlen );
  14.  
  15.  
  16.  
  17. DESCRIPTION
  18.        The parameter sockfd is  a  socket.   If  it  is  of  type
  19.        SOCK_DGRAM,  this  call  specifies the peer with which the
  20.        socket is to be associated; this address is that to  which
  21.        datagrams  are to be sent, and the only address from which
  22.        datagrams are to be received.  If the socket  is  of  type
  23.        SOCK_STREAM  ,  this call attempts to make a connection to
  24.        another  socket.   The  other  socket  is   specified   by
  25.        serv_addr, which is an address in the communications space
  26.        of the socket.  Each communications space  interprets  the
  27.        serv_addr,  parameter  in  its own way.  Generally, stream
  28.        sockets may successfully connect only once; datagram sock-
  29.        ets may use connect multiple times to change their associ-
  30.        ation.  Datagram sockets may dissolve the  association  by
  31.        connecting  to an invalid address, such as a null address.
  32.  
  33.  
  34.  
  35. RETURN VALUE
  36.        If the connection or binding succeeds, zero  is  returned.
  37.        On  error, -1 is returned, and errno is set appropriately.
  38.  
  39.  
  40.  
  41. ERRORS
  42.        See the Linux kernel source code for details.
  43.  
  44.  
  45.  
  46. HISTORY
  47.        The connect function call first appeared in BSD 4.2.
  48.  
  49.  
  50.  
  51. SEE ALSO
  52.        accept(2), bind(2), listen(2), socket(2), getsockname(2)

Raw Paste


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