Net.ConnectionNetwork connections.
val open' :
?nonblock:bool ->
?socket_type:Unix.socket_type ->
peer:Endpoint.t ->
unit ->
(t, string) Stdlib.resultopen ~peer () opens a connection to a peer listening on peer with:
nonblock if true the socket is in non-blocking mode (default).socket_type is the type of connection. Defaults to Unix.SOCK_STREAM or the fd's type if peer is `Fd fd – if socket_type is specified in this case this errors if fd is not of the specified type.cloexec set to true.peer is `Fd fd it is assumed to be connected. So the call just tries to honour the nonblock argument and gets it's peer and local address from the fd. Also note that in this case close_noerr does not close fd it's your duty to do so.If a connection is returned it must always eventually be closed with close_noerr.
val try_open :
?nonblock:bool ->
?socket_type:Unix.socket_type ->
peer:Endpoint.t ->
unit ->
(t option, string) Stdlib.resulttry_open ~endpoint is like open' except None is returned if Unix.connect errors with ENOENT, ECONNREFUSED or EHOSTUNREACH.
val close_noerr : t -> unitclose_noerr c closes c without raising errors and can be safely called repeatedly. Note that if peer c is `Fd fd this does not close fd.
val fd : t -> Unix.file_descrfd c is the file descriptor of c.
val peer : t -> Endpoint.tpeer c is the peer of c.
val peer_addr : t -> Unix.sockaddrpeer_addr c is the peer address for c.
val our_addr : t -> Unix.sockaddrour_addr c is our address for c.
val socket_type : t -> Unix.socket_typesocket_type c is the socket type of c.
val error : t -> string -> stringerror c msg formats an error message for connection c.
val pp : Stdlib.Format.formatter -> t -> unitpp formats connections for inspection.
val pp_debug : Stdlib.Format.formatter -> t -> unitpp_debug formats connection for more inspection.