Accepts a connection on a specified socket.
#include <prio.h> PRFileDesc* PR_Accept( PRFileDesc *fd, PRNetAddr *addr, PRIntervalTime timeout);
The function has the following parameters:
- A pointer to a
PRFileDescobject representing the rendezvous socket on which the caller is willing to accept new connections.
- A pointer to a structure of type
PRNetAddr. On output, this structure contains the address of the connecting entity.
- A value of type
PRIntervalTimespecifying the time limit for completion of the accept operation.
The function returns one of the following values:
- Upon successful acceptance of a connection, a pointer to a new
PRFileDescstructure representing the newly accepted connection.
- If unsuccessful,
NULL. Further information can be obtained by calling
fd is a rendezvous socket that has been bound to an address with
PR_Bind and is listening for connections after a call to
PR_Accept accepts the first connection from the queue of pending connections and creates a new socket for the newly accepted connection. The rendezvous socket can still be used to accept more connections.
addr parameter is not
PR_Accept stores the address of the connecting entity in the
PRNetAddr object pointed to by
PR_Accept blocks the calling thread until either a new connection is successfully accepted or an error occurs. If the timeout parameter is not
PR_INTERVAL_NO_TIMEOUT and no pending connection can be accepted before the time limit,
NULL with the error code