blob: c75454c3441f3e0f5e2b73298d6bfb4e645a5744 [file] [log] [blame]
Austin Schuh8d0a2852019-12-28 22:54:28 -08001.\" (C) Copyright Frank Filz IBM Corp. 2005.
2.\"
3.\" Permission is granted to distribute possibly modified copies
4.\" of this manual provided the header is included verbatim,
5.\" and in case of nontrivial modification author and date
6.\" of the modification is added to the header.
7.\"
8.TH SCTP_CONNECTX 3 2005-10-25 "Linux 2.6" "Linux Programmer's Manual"
9.SH NAME
10sctp_connectx \- initiate a connection on an SCTP socket using multiple
11destination addresses.
12.SH SYNOPSIS
13.nf
14.B #include <sys/types.h>
15.B #include <sys/socket.h>
16.B #include <netinet/sctp.h>
17.sp
18.BI "int sctp_connectx(int " sd ", struct sockaddr * " addrs ", int " addrcnt,
19.BI " sctp_assoc_t * "id );
20.fi
21.SH DESCRIPTION
22.BR sctp_connectx
23initiates a connection to a set of addresses passed in the array
24.I addrs
25to/from the socket
26.I sd.
27.I addrcnt
28is the number of addresses in the array.
29.PP
30If
31.I sd
32is an IPv4 socket, the addresses passed must be IPv4 addresses. If
33.I sd
34is an IPv6 socket, the addresses passed can be either IPv4 or IPv6
35addresses.
36.PP
37.I addrs
38is a pointer to an array of one or more socket addresses. Each address is
39contained in its appropriate structure(i.e. struct sockaddr_in or struct
40sockaddr_in6). The family of the address type must be used to distinguish
41the address length. The caller specifies the number of addresses in the
42array with
43.I addrcnt.
44.PP
45.I id
46is a pointer to the association id and, if provided, will be set to the
47identifier of the newly created association.
48.SH "RETURN VALUE"
49On success, 0 is returned. On failure, \-1 is returned, and
50.I errno
51is set appropriately.
52.SH ERRORS
53.TP
54.B EBADF
55.I sd
56is not a valid descriptor.
57.TP
58.B ENOTSOCK
59.I sd
60is a descriptor for a file, not a socket.
61.TP
62.B EFAULT
63Error while copying in or out from the user address space.
64.TP
65.B EINVAL
66Invalid port or address.
67.TP
68.B EACCES
69The address is protected, and the user is not the super-user.
70.TP
71.B EISCONN
72The socket is already connected.
73.TP
74.B ECONNREFUSED
75No one listening on the remote address.
76.TP
77.B ETIMEDOUT
78Timeout while attempting connection. The server may be too
79busy to accept new connections. Note that for IP sockets the timeout may
80be very long when syncookies are enabled on the server.
81.TP
82.B ENETUNREACH
83Network is unreachable.
84.TP
85.B EADDRINUSE
86Local address is already in use.
87.TP
88.B EINPROGRESS
89The socket is non-blocking and the connection cannot be completed
90immediately. It is possible to
91.BR select (2)
92or
93.BR poll (2)
94for completion by selecting the socket for writing. After
95.B select
96indicates writability, use
97.BR getsockopt (2)
98to read the
99.B SO_ERROR
100option at level
101.B SOL_SOCKET
102to determine whether
103.B connect
104completed successfully
105.RB ( SO_ERROR
106is zero) or unsuccessfully
107.RB ( SO_ERROR
108is one of the usual error codes listed here,
109explaining the reason for the failure).
110.TP
111.B EALREADY
112The socket is non-blocking and a previous connection attempt has not yet
113been completed.
114.TP
115.B EAGAIN
116No more free local ports or insufficient entries in the routing cache. For
117.B PF_INET
118see the
119.B net.ipv4.ip_local_port_range
120sysctl in
121.BR ip (7)
122on how to increase the number of local ports.
123.TP
124.B EAFNOSUPPORT
125The passed address didn't have the correct address family in its
126.I sa_family
127field.
128.TP
129.B EACCES, EPERM
130The user tried to connect to a broadcast address without having the socket
131broadcast flag enabled or the connection request failed because of a local
132firewall rule.
133.SH "SEE ALSO"
134.BR sctp (7)
135.BR sctp_bindx (3),
136.BR sctp_sendmsg (3),
137.BR sctp_sendv (3),
138.BR sctp_send (3),
139.BR sctp_recvmsg (3),
140.BR sctp_recvv (3),
141.BR sctp_peeloff (3),
142.BR sctp_getpaddrs (3),
143.BR sctp_getladdrs (3),
144.BR sctp_opt_info (3),