connect(2) DG/UX R4.11MU05 connect(2)
NAME
connect - initiate a connection on a socket
SYNOPSIS
#include <sys/socket.h>
int connect (s, name, namelen)
int s;
const struct sockaddr * name;
int namelen;
where:
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.
DIAGNOSTICS
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.
ECONNRESET The remote peer has accepted and then aborted the
connection before the connect(2) call could complete.
ENETUNREACH The network isn't reachable from this host.
EADDRINUSE A connection already exists using the specified remote
address to an endpoint with the same local address as
the socket argument.
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. This errno is returned on
the 88K platform only, other platforms return
EINPROGRESS.
EINPROGRESS The socket is non-blocking and the connection cannot
be completed immediately. The 88K platform returns
EAGAIN instead of EINPROGRESS. EINPROGRESS is the BSD
de-facto standard errno. EAGAIN is maintined on the
88K platform for application backward compability.
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
accept(2), listen(2), select(2), socket(2), getsockname(2).
Licensed material--property of copyright holder(s)