Go to the previous, next section.
int accept(int s, struct sockaddr *addr, int
*addrlen);
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.
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.
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:
EOPNOTSUPP
: The referenced socket is not of type
SOCK_STREAM
.
EWOULDBLOCK
: The socket is marked non-blocking and no
connection is pending.
EBADF
, ENOTSOCK
or EFAULT
Go to the previous, next section.