module Socket:sig
..end
module Address:sig
..end
module Family:sig
..end
type ([< `Active | `Bound | `Passive | `Unconnected ]
, [< Address.t ])
t
Unconnected ---connect--> Active | | ---bind--> Bound ---listen--> Passive ---accept---> Active
module Type:sig
..end
val create : ([< Address.t ] as 'a) Type.t ->
([ `Unconnected ], 'a) t
val connect : ([ `Unconnected ], [< Address.t ] as 'a)
t ->
'a -> ([ `Active ], 'a) t Import.Deferred.t
val connect_interruptible : ([ `Unconnected ], [< Address.t ] as 'a)
t ->
'a ->
interrupt:unit Import.Deferred.t ->
[ `Interrupted | `Ok of ([ `Active ], 'a) t ]
Import.Deferred.t
val bind : ([ `Unconnected ], [< Address.t ] as 'a)
t ->
'a -> ([ `Bound ], 'a) t Import.Deferred.t
bind socket addr
sets close_on_exec for the fd of socket
.val listen : ?max_pending_connections:int ->
([ `Bound ], [< Address.t ] as 'a)
t -> ([ `Passive ], 'a) t
val accept : ([ `Passive ], [< Address.t ] as 'a)
t ->
[ `Ok of ([ `Active ], 'a) t * 'a | `Socket_closed ]
Import.Deferred.t
val accept_interruptible : ([ `Passive ], [< Address.t ] as 'a)
t ->
interrupt:unit Import.Deferred.t ->
[ `Interrupted
| `Ok of ([ `Active ], 'a) t * 'a
| `Socket_closed ] Import.Deferred.t
val shutdown : ([< `Active | `Bound | `Passive | `Unconnected ],
[< Address.t ])
t -> [ `Both | `Receive | `Send ] -> unit
val fd : ([< `Active | `Bound | `Passive | `Unconnected ],
[< Address.t ])
t -> Fd.t
val of_fd : Fd.t ->
([< Address.t ] as 'a) Type.t ->
([< `Active | `Bound | `Passive | `Unconnected ], 'a) t
val getsockname : ([< `Active | `Bound | `Passive | `Unconnected ],
[< Address.t ] as 'a)
t -> 'a
val getpeername : ([< `Active | `Bound | `Passive | `Unconnected ],
[< Address.t ] as 'a)
t -> 'a
module Opt:sig
..end
val getopt : ([< `Active | `Bound | `Passive | `Unconnected ],
[< Address.t ])
t -> 'c Opt.t -> 'c
val setopt : ([< `Active | `Bound | `Passive | `Unconnected ],
[< Address.t ])
t -> 'c Opt.t -> 'c -> unit
val mcast_join : ?ifname:string ->
([< `Active | `Bound | `Passive | `Unconnected ],
[< Address.t ] as 'a)
t -> 'a -> unit
val mcast_leave : ?ifname:string ->
([< `Active | `Bound | `Passive | `Unconnected ],
[< Address.t ] as 'a)
t -> 'a -> unit
val sexp_of_t : (([< `Active | `Bound | `Passive | `Unconnected ] as 'a) -> Sexplib.Sexp.t) ->
(([< Address.t ] as 'b) -> Sexplib.Sexp.t) ->
('a, 'b) t -> Sexplib.Sexp.t
bind socket addr
sets close_on_exec for the fd of socket
.