Module Async_extended.Udp

val udp_server : addr:string ‑> port:int ‑> f:(Async.Socket.Address.Inet.t ‑> string ‑> unit Async.Deferred.t) ‑> unit Async.Deferred.t

udp_server addr port f except that f is called on every packet received with the address it was received from and the data received. The next packet will not be read until the Deferred returned by f is determined

val udp_client : addr:string ‑> port:int ‑> f:(Async.Writer.t ‑> 'a Async.Deferred.t) ‑> 'a Async.Deferred.t

udp_client ~addr ~port ~f Same as tcp_client for udp

val connect : [< `Inet of Async.Unix.Inet_addr.t * int | `Unix of string ] as a Async.Socket.Type.t ‑> addr:'a ‑> ([ `Active ], 'aAsync.Socket.t Async.Deferred.t

connect socket_type ~addr connects a socket to addr

val tcp_server_generic : ?max_connections:int ‑> addr:'a ‑> stype:'a Async.Socket.Type.t ‑> on_client_error:[ `Ignore | `Call of 'a ‑> exn ‑> unit ] ‑> f:('a ‑> Async.Reader.t ‑> Async.Writer.t ‑> unit Async.Deferred.t) ‑> ?buffer_age_limit:[ `At_most of Core.Time.Span.t | `Unlimited ] ‑> unit ‑> unit Async.Deferred.t
val tcp_server_unix : ?max_connections:int ‑> addr:Async.Socket.Address.Unix.t ‑> on_client_error:[ `Ignore | `Call of Async.Socket.Address.Unix.t ‑> exn ‑> unit ] ‑> f:(Async.Socket.Address.Unix.t ‑> Async.Reader.t ‑> Async.Writer.t ‑> unit Async.Deferred.t) ‑> ?buffer_age_limit:[ `At_most of Core.Time.Span.t | `Unlimited ] ‑> unit ‑> unit Async.Deferred.t

tcp_server_unix ~addr ~port ?on_client_error ~f makes a tcp server over a unix domain socket, listening on a path indicated by addr. When clients connect f will be run and is passed the address of the client, and a Reader and Writer for communicating with the client. When the deferred returned by f is determined or f throws an exception the client socket and the reader and writer will be closed. The Deferred returned by the function as a whole will be determined when the server is ready to accept incoming connections