Non blocking accept
Non-blocking accept() API highlights:
The accept() API call is now supports the non-blocking mode of operation.
Using non-blocking accept() mode, the host user application will not be stalled while the TCP connection with the remote client has not been established yet.
The non-blocking accept() API call returns immediately with one of the following status codes:
- Error(-1) - connection can not be established
- Pending(-2) - waiting for connection request from remote client
- new connection socket descriptor (>=0)- once TCP connection has been established.
Note: User Application is responsible to poll the TCP connection status by the calling accept() API periodically.
Starting from this release the default socket mode is non-blocking. If a used would like to configure legacy blocking mode,please refer to int setsockopt() in order to set-up the desired socket mode of operation.
Using setsockopt()to configure non-blocking mode:
int setsockopt ( long sd, long level, long optname, const void * optval, socklen_t optlen ) SOCK_NONBLOCK (optname). set socket non-blocking mode is on or off. SOCK_ON or SOCK_OFF (optval)