class type server_endpoint_acceptor =object
..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 : connect_address
method multiple_connections : bool
method accept : unit -> (Unix.file_descr * inetspec option) 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
(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 Unix.getpeername
returns.
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
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.