listen()

It listens for connections on a socket in order to accept incoming connection requests. Here is its syntax:

int listen(int sockfd, int lenque);

Here, sockfd represents the file descriptor of the socket, and lenque represents the maximum length of the queue of pending connections for the given socket. An error will be generated if the queue is full.

If the function is successful it returns zero, otherwise it returns -1.