HP-UX Reference (11i v2 04/09) - 2 System Calls (vol 5)
c
connect(2) connect(2)
AF_CCITT Only
Use the x25addrstr struct for the address structure. The caller must know the X.121 address of the
DTE to which the connection is to be established, including any subaddresses or protocol IDs that may be
needed. If address-matching by protocol ID, specify the protocol ID with the
X25_WR_USER_DATA
ioctl() call before issuing the connect() call.
DEPENDENCIES
AF_CCITT
The
SO_REUSEADDR option to setsockopt() is not supported for sockets in the AF_CCITT address
family.
RETURN VALUE
connect() returns the following values:
0 Successful completion.
-1 Failure.
errno is set to indicate the error.
ERRORS
If
connect() fails, errno is set to one of the following values.
[EADDRINUSE] The specified address is already in use.
For datagram sockets, the peer address is no longer maintained by the
system.
[EADDRNOTAVAIL] The specified address is not available on this machine, or the socket is a
TCP/UDP socket and the zero port number is specified.
For datagram sockets, the peer address is no longer maintained by the
system.
[EAFNOSUPPORT] The specified address is not a valid address for the address family of this
socket.
For datagram sockets, the peer address is no longer maintained by the
system.
[EALREADY] Nonblocking I/O is enabled with
O_NONBLOCK, O_NDELAY,or
FIOSNBIO, and a previous connection attempt has not yet completed.
[EBADF] s is not a valid file descriptor.
[ECONNREFUSED] The attempt to connect was forcefully rejected.
[EFAULT] addr is not a valid pointer.
[EINPROGRESS] Nonblocking I/O is enabled using
O_NONBLOCK, O_NDELAY,or
FIOSNBIO, and the connection cannot be completed immediately. This
is not a failure. Make the connect() call again a few seconds later.
Alternatively, wait for completion by calling select() and selecting for
write.
[EINTR] The connect was interrupted by a signal before the connect sequence was
complete. The building of the connection still takes place, even though
the user is not blocked on the
connect() call.
[EINVAL] The socket has already been shut down or has a
listen() active on it;
addrlen is a bad value; an attempt was made to connect() an
AF_UNIX socket to an NFS-mounted (remote) name; the X.121 address
length is zero, negative, or greater than 15 digits.
For datagram sockets, if addrlen is a bad value, the peer address is no
longer maintained by the system.
[EISCONN] The socket is already connected.
[ENETDOWN] The X.25 interface specified in the addr struct was found but was not in
the initialized state. x25ifname field name is an interface which has
been shut down or never initialized or suffered a power failure which
erased its state information.
HP-UX 11i Version 2: September 2004 − 2 − Hewlett-Packard Company Section 2−−45