Deleted Added
full compact
connect.2 (108028) connect.2 (108087)
1.\" Copyright (c) 1983, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)connect.2 8.1 (Berkeley) 6/4/93
1.\" Copyright (c) 1983, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)connect.2 8.1 (Berkeley) 6/4/93
33.\" $FreeBSD: head/lib/libc/sys/connect.2 108028 2002-12-18 09:22:32Z ru $
33.\" $FreeBSD: head/lib/libc/sys/connect.2 108087 2002-12-19 09:40:28Z ru $
34.\"
35.Dd June 4, 1993
36.Dt CONNECT 2
37.Os
38.Sh NAME
39.Nm connect
40.Nd initiate a connection on a socket
41.Sh LIBRARY
42.Lb libc
43.Sh SYNOPSIS
44.In sys/types.h
45.In sys/socket.h
46.Ft int
47.Fn connect "int s" "const struct sockaddr *name" "socklen_t namelen"
48.Sh DESCRIPTION
34.\"
35.Dd June 4, 1993
36.Dt CONNECT 2
37.Os
38.Sh NAME
39.Nm connect
40.Nd initiate a connection on a socket
41.Sh LIBRARY
42.Lb libc
43.Sh SYNOPSIS
44.In sys/types.h
45.In sys/socket.h
46.Ft int
47.Fn connect "int s" "const struct sockaddr *name" "socklen_t namelen"
48.Sh DESCRIPTION
49The parameter
49The
50.Fa s
50.Fa s
51argument
51is a socket.
52If it is of type
53.Dv SOCK_DGRAM ,
54this call specifies the peer with which the socket is to be associated;
55this address is that to which datagrams are to be sent,
56and the only address from which datagrams are to be received.
57If the socket is of type
58.Dv SOCK_STREAM ,
59this call attempts to make a connection to
60another socket.
61The other socket is specified by
62.Fa name ,
63which is an address in the communications space of the socket.
64Each communications space interprets the
65.Fa name
52is a socket.
53If it is of type
54.Dv SOCK_DGRAM ,
55this call specifies the peer with which the socket is to be associated;
56this address is that to which datagrams are to be sent,
57and the only address from which datagrams are to be received.
58If the socket is of type
59.Dv SOCK_STREAM ,
60this call attempts to make a connection to
61another socket.
62The other socket is specified by
63.Fa name ,
64which is an address in the communications space of the socket.
65Each communications space interprets the
66.Fa name
66parameter in its own way.
67argument in its own way.
67Generally, stream sockets may successfully
68.Fn connect
69only once; datagram sockets may use
70.Fn connect
71multiple times to change their association.
72Datagram sockets may dissolve the association
73by connecting to an invalid address, such as a null address.
74.Sh RETURN VALUES
75.Rv -std connect
76.Sh ERRORS
77The
78.Fn connect
79system call fails if:
80.Bl -tag -width Er
81.It Bq Er EBADF
68Generally, stream sockets may successfully
69.Fn connect
70only once; datagram sockets may use
71.Fn connect
72multiple times to change their association.
73Datagram sockets may dissolve the association
74by connecting to an invalid address, such as a null address.
75.Sh RETURN VALUES
76.Rv -std connect
77.Sh ERRORS
78The
79.Fn connect
80system call fails if:
81.Bl -tag -width Er
82.It Bq Er EBADF
83The
82.Fa s
84.Fa s
85argument
83is not a valid descriptor.
84.It Bq Er ENOTSOCK
86is not a valid descriptor.
87.It Bq Er ENOTSOCK
88The
85.Fa s
89.Fa s
90argument
86is a descriptor for a file, not a socket.
87.It Bq Er EADDRNOTAVAIL
88The specified address is not available on this machine.
89.It Bq Er EAFNOSUPPORT
90Addresses in the specified address family cannot be used with this socket.
91.It Bq Er EISCONN
92The socket is already connected.
93.It Bq Er ETIMEDOUT
94Connection establishment timed out without establishing a connection.
95.It Bq Er ECONNREFUSED
96The attempt to connect was forcefully rejected.
97.It Bq Er ENETUNREACH
98The network isn't reachable from this host.
99.It Bq Er EADDRINUSE
100The address is already in use.
101.It Bq Er EFAULT
102The
103.Fa name
91is a descriptor for a file, not a socket.
92.It Bq Er EADDRNOTAVAIL
93The specified address is not available on this machine.
94.It Bq Er EAFNOSUPPORT
95Addresses in the specified address family cannot be used with this socket.
96.It Bq Er EISCONN
97The socket is already connected.
98.It Bq Er ETIMEDOUT
99Connection establishment timed out without establishing a connection.
100.It Bq Er ECONNREFUSED
101The attempt to connect was forcefully rejected.
102.It Bq Er ENETUNREACH
103The network isn't reachable from this host.
104.It Bq Er EADDRINUSE
105The address is already in use.
106.It Bq Er EFAULT
107The
108.Fa name
104parameter specifies an area outside
109argument specifies an area outside
105the process address space.
106.It Bq Er EINPROGRESS
107The socket is non-blocking
108and the connection cannot
109be completed immediately.
110It is possible to
111.Xr select 2
112for completion by selecting the socket for writing.

--- 34 unchanged lines hidden ---
110the process address space.
111.It Bq Er EINPROGRESS
112The socket is non-blocking
113and the connection cannot
114be completed immediately.
115It is possible to
116.Xr select 2
117for completion by selecting the socket for writing.

--- 34 unchanged lines hidden ---