Net.ListenerNetwork connection listeners.
val open' :
?nonblock:bool ->
?socket_type:Unix.socket_type ->
?backlog:int ->
endpoint:Endpoint.t ->
unit ->
(t, string) Stdlib.resultopen' ~endpoint () opens a connection listener on endpoint with:
nonblock if true the listening socket and accepted connection are in non-blocking mode (default).socket_type is the type of connection. Defaults to Unix.SOCK_STREAM or the fd's type if on is `Fd fd – if socket_type is specified in this case this errors if fd is not of the specified type.backlog is the argument for Unix.listen (defaults to 128). Only relevant if socket_type is Unix.SOCK_STREAM.cloexec set to true.peer is `Fd fd it is assumed to be already bound with Unix.bind. So the call just tries to honour the nonblock argument, gets local address from the fd and calls Unix.listen if the socket type is Unix.SOCK_STREAM. Also note that in this case close_noerr does not close fd it is your duty to do so.If a listener is returned it must always eventually be closed with close_noerr.
Note. If you used an endpoint with a port 0, endpoint or endpoint_addr have the port that has been attributed by the operating system.
val close_noerr : t -> unitclose_noerr l closes l without raising errors and can be safely called repeatedly. Note that if endpoint c is `Fd fd this does not close fd.
val accept : t -> (Connection.t, string) Stdlib.resultaccept l offers a connection on l. Blocks until a client connects. If a connection is returned, it must always eventually be closed with Connection.close_noerr.
val wait_connection : t -> 'tag -> 'tag Affect.Action.twait_connection l t is the action used by accept. The action invocation is enabled and synchronizes with tag whenever accept can be called without blocking. This is just Affect_unix.Unix.wait_readable on the listener fd.
val fd : t -> Unix.file_descrfd l is the listening file descriptor of l.
val endpoint : t -> Endpoint.tendpoint l is the endpoint on which of l is listening. If you open'ed with a port of 0 this gives you the endpoint with the port that was attributed by the operating system.
val endpoint_addr : t -> Unix.sockaddrendpoint_addr l is the socket address on which l is listening.
val socket_type : t -> Unix.socket_typesocket_type l is the socket type of the listener.
val error : t -> string -> stringerror l msg formats an error message for listener l.
val pp : Stdlib.Format.formatter -> t -> unitpp formats connection listeners for inspection.
val pp_debug : Stdlib.Format.formatter -> t -> unitpp_debug formats connection listeners for more inspection.