class type server_endpoint_acceptor =
This class type is for service providers that listen for connections.
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 :
The contact address under which the clients can establish new connections with this server.
method multiple_connections :
Whether it is possible to accept multiple connections
method accept :
unit -> (Unix.file_descr * Uq_engines.inetspec option) Uq_engines.engine
Instantiates an engine that accepts connections on the listening endpoint.
If the connection is successfully established, the state of the engine
fd is the connected file descriptor,
addr (if not-
None) is the endpoint address of the
connecting client (from the server's perspective). Such addresses are
only supported for Internet endpoints. If a proxy is used to accept
the connections, the returned address is that from the proxy's
view, and usually different from what
The close-on-exec flag of the created endpoint descriptor is always set. The endpoint descriptor is always in non-blocking mode.
It is allowed to shut down
fd for sending, and it is required to
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
when the previous engine was successful.
method shut_down :
unit -> unit
The server endpoint is shut down such that no further connections
are possible. It is required to call this method even for acceptors
that do not support multiple connections. It is also required to
call this method when an
accept was not successful.
If there is a engine waiting for connections, it is aborted.