module Versioned:sig
..end
val establish_server_1 : ?fd:Lwt_unix.file_descr ->
?buffer_size:int ->
?backlog:int ->
Unix.sockaddr ->
(Lwt_io.input_channel * Lwt_io.output_channel -> unit) -> Lwt_io.server
Lwt_io.Versioned.establish_server_2
.Lwt_io.establish_server
.val establish_server_2 : ?fd:Lwt_unix.file_descr ->
?buffer_size:int ->
?backlog:int ->
?no_close:bool ->
Unix.sockaddr ->
(Lwt_io.input_channel * Lwt_io.output_channel -> unit Lwt.t) ->
Lwt_io.server Lwt.t
establish_server_2 sockaddr f
creates a server which listens for
incoming connections. New connections are passed to f
. When threads
returned by f
complete, the connections are closed automatically. To
prevent automatic closing, apply establish_server_2
with
~no_close:true
.
The ?fd
and ?backlog
arguments have the same meaning as in
Lwt_io.establish_server
. ?buffer_size
sets the internal buffer size
of the channels passed to f
.
The server does not wait for each thread. It begins accepting new connections immediately.
If a thread raises an exception, it is passed to
!Lwt.async_exception_hook
. Likewise, if the automatic close
of a
connection raises an exception, it is passed to
!Lwt.async_exception_hook
. To robustly handle these exceptions, you
should call close
manually inside f
, and use your own handler.
Since 2.7.0
val shutdown_server_1 : Lwt_io.server -> unit
Lwt_io.Versioned.shutdown_server_2
.Lwt_io.shutdown_server
.val shutdown_server_2 : Lwt_io.server -> unit Lwt.t
close
system call to complete.
This function does not affect sockets of connections that have already
been accepted by the server, i.e. those passed by establish_server
to
its callback f
.
Since 2.7.0