Places the socket into a state, where it is listening for an incoming connection.
- Parameters
-
s | Descriptor identifying a socket that will be used for listening. |
backlog | Maximum length of the queue of pending connections. |
- Returns
- This function returns:
- See also
- fnet_socket(), fnet_socket_bind(), fnet_socket_accept()
Only connection-oriented sockets (SOCK_STREAM) are used with the fnet_socket_listen().
The socket is put into passive mode, where the incoming connection requests are acknowledged and queued pending acceptance by the listening socket. The fnet_socket_listen() function is typically used by servers that can have more than one connection request at a time.
An application can call fnet_socket_listen() more than once on the same socket. If there are more pending connections than the new backlog value, the excess pending connections will be reset and dropped. Once pending connections accepted by application using fnet_socket_accept(), they are removed from backlog.