Synopsis:
socket=Saccept(lsock,[timeout_10ths,&pAddr,&pPort])
Arguments:
lsock - The listening socket to accept connections on
[timeout_10ths] - Optional timeout (in1/10 secs) to block waiting for connection
[pAddr] - Optional pointer to a variable that will hold the IP address of connecting client
[pPort] - Optional pointer to a variable that will hold the IP port of connecting client
Description: This function attempts to accept an incoming connection on a listening socket created by Slisten(). If there is are no inbound connections waiting then the function returns -3 (EWOULDBLOCK) which allows the function to be used to poll for incoming connections.
If the optional timeout_10ths argument is specified then the function will block until either a connection request is received or the timeout period expires (after which it will return -3).
The variables pointed to by the optional pAddr and pPort argument will hold the IP address and port of the connecting client if a connection is made.
The socket handle returned from this function (>=0) should then be used in subsequent calls to Srecv(), Ssend(), Scheck() etc.
An alternative way of polling for connections on a listening socket is to use Scheck() to check for read capabillity on the listening socket. As soon as the listening socket becomes readable then this indicates that the is an inbound connection request and a call to Saccept() is sure to succeed.
Returns: Returns the handle to an inbound socket connection (>= 0), or -3 (EWOULDBLOCK) if there were no inbound connections waiting, or any other negative value indicates and error.