class type server_socket_acceptor =This class type is for service providers that listen for connections. By callingobject
..end
accept
, one gets an engine that waits for the next
connection, and establishes it.
There are services that can only accept one connection for a
certain contact address. In this case accept
must only be called
once. Normally, services can accept any number of connections
(multiplexing), and it is allowed to call accept
again after
the previous accept engine was successful.
method server_address : sockspec
method multiple_connections : bool
method accept : unit -> (Unix.file_descr * sockspec) engine
If the connection is successfully established, the state of the engine
changes to `Done(fd,addr)
where fd
is the connected file descriptor,
and where addr
is the socket address of the connecting client
(from the server's perspective).
The close-on-exec flag of the created socket descriptor is always set. The socket descriptor is always in non-blocking mode.
It is allowed to shut down fd
for sending, and it is required to
close fd
after all data transfers have been performed.
A call of accept
allows it only to establish one connection at a time.
However, it is allowed to call accept
several times to accept several
connections, provided the acceptor supports this (returned by
multiple_connections
). It is only allowed to call accept
again
when the previous engine was successful.
method shut_down : unit -> unit
accept
was not successful.
If there is a engine waiting for connections, it is aborted.