Go to the previous, next section.

accept

SYNOPSIS

int accept(int s, struct sockaddr *addr, int *addrlen);

PARAMETERS

s: [in] the socket connections are accepted from.

addr: [out] contains the address of the the buffer that will be filled with the address of connecting entity.

addrlen: [out] on input contains the maximum length of addr in bytes, on output contains the length of addr in bytes.

DESCRIPTION

If connections are pending on the socket s, the first connection in the queue is dequeued and opened and a new socket with the same properties of s is returned. If no connection is pending and the socket is blocking, then the call blocks until a connection is requested on s. Otherwise the call returns an error code. The socket s remains open for future connections. The address of the connecting entity is returned in addr. The format of the address depends on the type of network on through which the socket communicates. accept does not send a confirmation at the connecting entity.

RETURN VALUE

On success, the call returns a positive value that is the file descriptor of the new socket. On errror, the call returns -1 and sets errno to one of the following error values:

Go to the previous, next section.