text: table of contents
  NAME¶
  connect - initiate a connection on a socket
  SYNOPSIS¶
  #include <sys/types.h> /* See NOTES */ #include <sys/socket.h>
  int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
  DESCRIPTION¶
  The.
  Some protocol sockets (e.g., UNIX domain stream sockets) may successfully connect() only once.
  Some protocol sockets (e.g., datagram sockets in the UNIX and Internet domains) may use connect() multiple times to change their association.
  Some protocol sockets (e.g., TCP sockets as well as datagram sockets in the UNIX and Internet domains) may dissolve the association by connecting to an address with the sa_family member of sockaddr set to AF_UNSPEC; thereafter, the socket can be connected to another address. (AF_UNSPEC is supported on Linux since kernel 2.2.)
  RETURN VALUE¶
  If the connection or binding succeeds, zero is returned. On error, -1 is returned, and errno is set appropriately.
  ERRORS¶ACCES can also be returned if an SELinux policy denied a connection (for example, if there is a policy saying that an HTTP proxy can only connect to ports associated with HTTP servers, and the proxy tries to connect to a different port). dd
  -
  POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD, (connect() first appeared in 4.2BSD).
  NOTES¶.
  EXAMPLES¶
  An example of the use of connect() is shown in getaddrinfo(3).
  SEE ALSO¶
  accept(2), bind(2), getsockname(2), listen(2), socket(2), path_resolution(7), selinux(8)
  COLOPHON¶
  This page is part of release 5.10 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at.