Accepts a new connection and receives a block of data.
#include <prio.h> PRInt32 PR_AcceptRead( PRFileDesc *listenSock, PRFileDesc **acceptedSock, PRNetAddr **peerAddr, void *buf, PRInt32 amount, PRIntervalTime timeout);
The function has the following parameters:
listenSock
PRFileDesc
object representing a socket descriptor that has been called with the PR_Listen
function, also known as the rendezvous socket.acceptedSock
PRFileDesc
object. On return, *acceptedSock
points to the PRFileDesc
object for the newly connected socket. This parameter is valid only if the function return does not indicate failure.peerAddr
PRNetAddr
object. On return, peerAddr
points to the address of the remote socket. The PRNetAddr
object that peerAddr
points to will be in the buffer pointed to by buf
. This parameter is valid only if the function return does not indicate failure.buf
amount
bytes of data and two PRNetAddr
structures (thus allowing the runtime to align the addresses as needed).amount
PRNetAddr
structures. If 0, no data will be read from the peer.timeout
PR_AcceptRead
blocks indefinitely until the connection is accepted; the read will time out after the timeout interval elapses.PR_GetError
.PR_AcceptRead
accepts a new connection and retrieves the newly created socket's descriptor and the connecting peer's address. Also, as its name suggests, PR_AcceptRead
receives the first block of data sent by the peer.