lpc4/lib/
lpc4/lib/doc/efun/
lpc4/lib/doc/lfun/
lpc4/lib/doc/operators/
lpc4/lib/doc/simul_efuns/
lpc4/lib/doc/types/
lpc4/lib/etc/
lpc4/lib/include/
lpc4/lib/include/arpa/
lpc4/lib/obj/d/
lpc4/lib/save/
lpc4/lib/secure/
lpc4/lib/std/
lpc4/lib/std/living/
NAME
	socket_listen - listen for connections on a socket

SYNOPSIS
	#include <socket.h>
	#include <socket_errors.h>

	int socket_listen(int s, function listen_callback)

DESCRIPTION
	To accept connections, a socket is first created with socket_create,
	the socket is them put into listening mode with socket_listen, and
	the connections are accepted with socket_accept. The socket_listen()
	call applies only to sockets of type STREAM.

	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:

	void listen_callback(int fd)

	Where fd is the listening socket.

RETURN VALUES
	socket_listen() returns:
		EESUCCESS on success.
		a negative value indicated below on error.

ERRORS
	EEFDRANGE	Descriptor out of range.
	EEBADF		Descriptor is invalid.
	EESECURITY	Security violation attempted.
	EEMODENOTSUPP	Socket mode not supported.
	EENOADDR	Socket not bound to an address.
	EEISCONN	Socket is already connected.
	EELISTEN	Problem with listen.

SEE ALSO
	socket_accept, socket_connect, socket_create