connect(2) DG/UX 4.30 connect(2)
NAME
connect - Initiate a connection on a socket.
SYNOPSIS
#include <sys/socket.h>
int connect (s, name, namelen)
int s;
struct sockaddr * name;
int namelen;
PARAMETERS
s The file descriptor of a socket to connect.
name Name of peer or listening socket through
which the connection will be made.
namelen Length of name (bytes).
DESCRIPTION
The parameter <s> is a socket. If it is of type SOCK_DGRAM,
then this call specifies the peer to which datagrams are to
be sent; if it is of type SOCK_STREAM, then this call tries
to make a connection through a listening socket specified by
<name>, which is an address in the communications space of
the socket.
ACCESS CONTROL
None. See the related documentation on the individual
communication protocol for specific domain interpretations.
RETURN VALUE
0 Completed successfully, a connection has been
established.
-1 An error occurred. Errno is set to indicate
the error.
EXCEPTIONS
Errno may be set to one of the following error codes:
EBADF <s> is not active, valid descriptor.
ENOTSOCK <s> is a descriptor for a file, not a socket.
EADDRNOTAVAIL The specified address is not available on the
Licensed material--property of copyright holder(s) Page 1
connect(2) DG/UX 4.30 connect(2)
specified host.
EAFNOSUPPORT Addresses in the specified address family
cannot be used with this socket.
EISCONN The socket is already connected.
ETIMEDOUT Connection establishment timed out without
establishing a connection.
ECONNREFUSED The attempt to connect was rejected by
foreign host.
ENETUNREACH The network isn't reachable from this host.
EADDRINUSE The address is already in use.
EFAULT The <name> parameter specifies an area
outside the process address space.
EAGAIN The socket is non-blocking and the connection
cannot be completed immediately.
ENOBUFS No internal buffers available.
EINVAL Invalid system call argument (probably name
length).
EALREADY The connect operation has already been
started on this socket and has not yet
finished. (An earlier call must have
returned EAGAIN or EINTR.)
EINTR System call returned due to interrupt.
EOPNOTSUPP The socket is in the listen state.
SEE ALSO
The related manual sections: accept(2), listen(2),
select(2), socket(2), getsockname(2).
Licensed material--property of copyright holder(s) Page 2