Module Unix_syscalls.Socket

module Socket: sig .. end

type unix = [ `Unix of string ] 
val bin_size_unix : unix Bin_prot.Size.sizer
val bin_write_unix : unix Bin_prot.Write_ml.writer
val bin_write_unix_ : unix Bin_prot.Unsafe_write_c.writer
val bin_writer_unix : unix Bin_prot.Type_class.writer
val bin_read_unix : unix Bin_prot.Read_ml.reader
val bin_read_unix_ : unix Bin_prot.Unsafe_read_c.reader
val bin_read_unix__ : (int -> unix) Bin_prot.Unsafe_read_c.reader
val bin_reader_unix : unix Bin_prot.Type_class.reader
val bin_unix : unix Bin_prot.Type_class.t
val sexp_of_unix : unix -> Sexplib.Sexp.t
val unix_of_sexp : Sexplib.Sexp.t -> unix
val unix_of_sexp__ : Sexplib.Sexp.t -> unix
type inet = [ `Inet of Unix_syscalls.Inet_addr.t * int ] 
val bin_size_inet : inet Bin_prot.Size.sizer
val bin_write_inet : inet Bin_prot.Write_ml.writer
val bin_write_inet_ : inet Bin_prot.Unsafe_write_c.writer
val bin_writer_inet : inet Bin_prot.Type_class.writer
val bin_read_inet : inet Bin_prot.Read_ml.reader
val bin_read_inet_ : inet Bin_prot.Unsafe_read_c.reader
val bin_read_inet__ : (int -> inet) Bin_prot.Unsafe_read_c.reader
val bin_reader_inet : inet Bin_prot.Type_class.reader
val bin_inet : inet Bin_prot.Type_class.t
val sexp_of_inet : inet -> Sexplib.Sexp.t
val inet_of_sexp : Sexplib.Sexp.t -> inet
val inet_of_sexp__ : Sexplib.Sexp.t -> inet
type [< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] addr = [< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a 
val bin_size_addr : ([< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
Bin_prot.Size.sizer ->
'a addr Bin_prot.Size.sizer
val bin_write_addr : ([< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
Bin_prot.Unsafe_write_c.writer ->
'a addr Bin_prot.Write_ml.writer
val bin_write_addr_ : ([< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
Bin_prot.Unsafe_write_c.writer ->
'a addr Bin_prot.Unsafe_write_c.writer
val bin_writer_addr : ([< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
Bin_prot.Type_class.writer ->
'a addr Bin_prot.Type_class.writer
val bin_read_addr : ([< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
Bin_prot.Unsafe_read_c.reader ->
'a addr Bin_prot.Read_ml.reader
val bin_read_addr_ : ([< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
Bin_prot.Unsafe_read_c.reader ->
'a addr Bin_prot.Unsafe_read_c.reader
val bin_read_addr__ : ([< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
Bin_prot.Unsafe_read_c.reader ->
(int -> 'a addr) Bin_prot.Unsafe_read_c.reader
val bin_reader_addr : ([< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
Bin_prot.Type_class.reader ->
'a addr Bin_prot.Type_class.reader
val bin_addr : ([< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
Bin_prot.Type_class.t ->
'a addr Bin_prot.Type_class.t
val sexp_of_addr : (([< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a) ->
Sexplib.Sexp.t) ->
'a addr -> Sexplib.Sexp.t
val addr_of_sexp : (Sexplib.Sexp.t ->
([< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)) ->
Sexplib.Sexp.t -> 'a addr
val address_string_of_inet : inet -> string
val string_of_inet : inet -> string
val string_of_unix : unix -> string
module Address: sig .. end
module Family: sig .. end
type ([< `Active | `Bound | `Passive | `Unconnected ]
, [< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ])
t
Sockets have a phantom type parameter that tracks the state of the socket in order to eliminate certain errors in which socket functions are called in the wrong order. Initially, a socket is `Unconnected. As various socket functions are called, they return a socket with a new phantom state. Here is a chart of the allowed state transitions.

Unconnected ---connect--> Active | ---bind--> Bound ---listen--> Passive ---accept---> Active

module Type: sig .. end
val create : ([< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
Type.t -> ([ `Unconnected ], 'a) t
val connect : ([ `Unconnected ],
[< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
t ->
'a -> ([ `Active ], 'a) t Import.Deferred.t
val connect_interruptible : ([ `Unconnected ],
[< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
t ->
'a ->
interrupt:unit Import.Deferred.t ->
[ `Interrupted | `Ok of ([ `Active ], 'a) t ]
Import.Deferred.t
val bind : ([ `Unconnected ],
[< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
t ->
'a -> ([ `Bound ], 'a) t Import.Deferred.t
val listen : ?max_pending_connections:int ->
([ `Bound ],
[< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
t -> ([ `Passive ], 'a) t
val accept : ([ `Passive ],
[< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
t ->
(([ `Active ], 'a) t * 'a) Import.Deferred.t
val accept_interruptible : ([ `Passive ],
[< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
t ->
interrupt:unit Import.Deferred.t ->
[ `Interrupted | `Ok of ([ `Active ], 'a) t * 'a ]
Import.Deferred.t
val shutdown : ([< `Active | `Bound | `Passive | `Unconnected ],
[< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ])
t -> [ `Both | `Receive | `Send ] -> unit
val fd : ([< `Active | `Bound | `Passive | `Unconnected ],
[< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ])
t -> Fd.t
val of_fd : Fd.t ->
([< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
Type.t ->
([< `Active | `Bound | `Passive | `Unconnected ], 'a) t
val getsockname : ([< `Active | `Bound | `Passive | `Unconnected ],
[< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
t -> 'a
val getpeername : ([< `Active | `Bound | `Passive | `Unconnected ],
[< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ] as 'a)
t -> 'a
module Opt: sig .. end
val getopt : ([< `Active | `Bound | `Passive | `Unconnected ],
[< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ])
t -> 'c Opt.t -> 'c
val setopt : ([< `Active | `Bound | `Passive | `Unconnected ],
[< `Inet of Unix_syscalls.Inet_addr.t * int | `Unix of string ])
t -> 'c Opt.t -> 'c -> unit