LISTEN(2)

NAME
listen - listens for incoming connections on a socket

SYNOPSIS
#include <sys/socket.h>
int listen(int sd, int backlog);

DESCRIPTION
listen() puts socket sd into the listening state. backlog number of incoming connections may be queued before new incoming connections are refused. This function is usually called after bind(2) and before accept(2).

RETURN VALUES
On success, this function returns 0. On error, -1 is returned and errno is set.

ERRORS

[EINVAL]
    The socket is invalid or bind(2) has not been called yet for the socket.

[EOPNOTSUPP]
    The socket type (example SOCK_DGRAM) does not support listening.

[ENOSYS]
    The socket does not support listening.

SEE ALSO
accept(2), bind(2), socket(2)