sig
type 'a where_to_connect constraint 'a = [< Import.Socket.Address.t ]
val to_host_and_port :
string -> int -> Import.Socket.Address.Inet.t Tcp.where_to_connect
val to_file : string -> Import.Socket.Address.Unix.t Tcp.where_to_connect
type 'a with_connect_options =
?buffer_age_limit:[ `At_most of Core.Std.Time.Span.t | `Unlimited ] ->
?interrupt:unit Import.Deferred.t ->
?reader_buffer_size:int -> ?timeout:Core.Std.Time.Span.t -> 'a
val with_connection :
(([< Import.Socket.Address.t ] as 'b) Tcp.where_to_connect ->
(([ `Active ], 'b) Import.Socket.t ->
Import.Reader.t -> Import.Writer.t -> 'a Import.Deferred.t) ->
'a Import.Deferred.t)
Tcp.with_connect_options
val connect_sock :
([< Import.Socket.Address.t ] as 'a) Tcp.where_to_connect ->
([ `Active ], 'a) Import.Socket.t Import.Deferred.t
val connect :
(([< Import.Socket.Address.t ] as 'a) Tcp.where_to_connect ->
(([ `Active ], 'a) Import.Socket.t * Import.Reader.t * Import.Writer.t)
Import.Deferred.t)
Tcp.with_connect_options
module Where_to_listen :
sig
type ('a, 'listening_on) t constraint 'a = [< Import.Socket.Address.t ]
type inet = (Import.Socket.Address.Inet.t, int) Tcp.Where_to_listen.t
type unix =
(Import.Socket.Address.Unix.t, string) Tcp.Where_to_listen.t
val create :
socket_type:([< Import.Socket.Address.t ] as 'a) Import.Socket.Type.t ->
address:'a ->
listening_on:('a -> 'listening_on) ->
('a, 'listening_on) Tcp.Where_to_listen.t
end
val on_port : int -> Tcp.Where_to_listen.inet
val on_port_chosen_by_os : Tcp.Where_to_listen.inet
val on_file : string -> Tcp.Where_to_listen.unix
module Server :
sig
type ('a, 'listening_on) t constraint 'a = [< Import.Socket.Address.t ]
type inet = (Import.Socket.Address.Inet.t, int) Tcp.Server.t
type unix = (Import.Socket.Address.Unix.t, string) Tcp.Server.t
val invariant : ([< Import.Socket.Address.t ], 'a) Tcp.Server.t -> unit
val listening_on :
([< Import.Socket.Address.t ], 'listening_on) Tcp.Server.t ->
'listening_on
val close :
([< Import.Socket.Address.t ], 'a) Tcp.Server.t ->
unit Import.Deferred.t
val close_finished :
([< Import.Socket.Address.t ], 'a) Tcp.Server.t ->
unit Import.Deferred.t
val is_closed : ([< Import.Socket.Address.t ], 'a) Tcp.Server.t -> bool
val create :
?max_connections:int ->
?max_pending_connections:int ->
?buffer_age_limit:Import.Writer.buffer_age_limit ->
?on_handler_error:[ `Call of
([< Import.Socket.Address.t ] as 'a) ->
exn -> unit
| `Ignore
| `Raise ] ->
('a, 'listening_on) Tcp.Where_to_listen.t ->
('a -> Import.Reader.t -> Import.Writer.t -> unit Import.Deferred.t) ->
('a, 'listening_on) Tcp.Server.t Import.Deferred.t
end
end