After the socket socket has been created using socket(), bound to a name with bind(), and told to listen for connections with listen(), this function will accept incoming connections on that socket. Once a successful connection is made, a new socket descriptor is returned, which may be used for communication. If there are multiple connections queued on the socket, the first will be used. If there are no pending connections, accept_connect() will block until a connection becomes present. If socket has been made non-blocking using socket_set_blocking() or set_nonblock(), an error code will be returned.
The socket descriptor returned by accept_connect() may not be used to accept new connections. The original listening socket socket, however, remains open and may be reused.
Returns a new socket descriptor on success, or a negative error code on failure. This code may be passed to strerror() to get a textual explanation of the error.
See also bind(), connect(), listen(), socket(), socket_get_status(), and strerror().