connect(2)
_________________________________________________________________
connect System Call
Initiate a connection on a socket.
_________________________________________________________________
SYNTAX
#include <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.
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
connect(2)
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
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).
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)
connect(2)
EINPROGRESS 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.
SEE ALSO
The related manual sections: accept(2), select(2), socket(2),
getsockname(2).
DG/UX 4.00 Page 3
Licensed material--property of copyright holder(s)