is a socket that has been created with
bound to an address with
and is listening for connections after a
system call extracts the first connection request on the
queue of pending connections, creates a new socket,
and allocates a new file descriptor for the socket which
inherits the state of the
properties and the destination of
signals from the original socket
system call is similar,
property of the new socket is instead determined by the
flag in the
property is cleared,
the signal destination is cleared
and the close-on-exec flag on the new file descriptor can be set via the
flag in the
If no pending connections are
present on the queue, and the original socket
is not marked as non-blocking,
blocks the caller until a connection is present.
If the original socket
is marked non-blocking and no pending
connections are present on the queue,
returns an error as described below.
The accepted socket
may not be used
to accept more connections.
The original socket
is a result argument that is filled-in with
the address of the connecting entity,
as known to the communications layer.
The exact format of the
argument is determined by the domain in which the communication
A null pointer may be specified for
if the address information is not desired;
in this case,
is not used and should also be null.
is a value-result argument; it should initially contain the
amount of space pointed to by
on return it will contain the actual length (in bytes) of the
is used with connection-based socket types, currently with
It is possible to
a socket for the purposes of doing an
by selecting it for read.
For certain protocols which require an explicit confirmation,
can be thought of
as merely dequeueing the next connection
request and not implying confirmation.
Confirmation can be implied by a normal read or write on the new
file descriptor, and rejection can be implied by closing the
For some applications, performance may be enhanced by using an
to pre-process incoming connections.
portable programs should not rely on the
properties and the signal destination being inherited,
but should set them explicitly using
sets these properties consistently,
but may not be fully portable across