.\"listen for connections on a socket .TH socket_listen 3 .SH NAME socket_listen() - listen for connections on a socket .SH SYNOPSIS .nf #include #include int socket_listen(int s, string listen_callback) .SH DESCRIPTION To accept connections, a socket is first created with socket_create(3), the socket is them put into listening mode with socket_listen(3), and the connections are accepted with socket_accept(3). The socket_listen() call applies only to sockets of type STREAM or MUD. .PP The argument listen_callback is the name of a function for the driver to call when a connection is requested on the listening socket. The listen callback should follow this format: .IP void listen_callback(int fd) .PP Where fd is the listening socket. .SH RETURN VALUES socket_listen() returns: .IP EESUCCESS on success. .IP a negative value indicated below on error. .SH ERRORS .TP 15 EEFDRANGE Descriptor out of range. .TP EEBADF Descriptor is invalid. .TP EESECURITY Security violation attempted. .TP EEMODENOTSUPP Socket mode not supported. .TP EENOADDR Socket not bound to an address. .TP EEISCONN Socket is already connected. .TP EELISTEN Problem with listen. .SH SEE ALSO socket_accept(3), socket_connect(3), socket_create(3)