Table of Contents

NAME

SYNOPSIS

DESCRIPTION

The argument is a socket that has been created with bound to an address with and is listening for connections after a The argument extracts the first connection request on the queue of pending connections, creates a new socket with the same properties of and allocates a new file descriptor for the socket. If no pending connections are present on the queue, and the socket is not marked as non-blocking, blocks the caller until a connection is present. If the 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 remains open. The argument is a result parameter that is filled in with the address of the connecting entity, as known to the communications layer. The exact format of the parameter is determined by the domain in which the communication is occurring. The is a value-result parameter; it should initially contain the amount of space pointed to by on return it will contain the actual length (in bytes) of the address returned. This call 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, such as or can be thought of as merely dequeuing 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 new socket. One can obtain user connection request data without confirming the connection by issuing a call with an of 0 and a non-zero or by issuing a request. Similarly, one can provide user connection rejection information by issuing a call with providing only the control information, or by calling

RETURN VALUES

The call returns -1 on error. If it succeeds, it returns a non-negative integer that is a descriptor for the accepted socket.

ERRORS

The will fail if: The descriptor is invalid. The descriptor references a file, not a socket. The referenced socket is not of type The parameter is not in a writable part of the user address space. The socket is marked non-blocking and no connections are present to be accepted.

SEE ALSO

HISTORY

The function appeared in


Table of Contents