Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
module Peer : sig ... end
val wrap_connection_to_peer :
Peer.t ->
my_name:string ->
f:([ `Sent | `Received ] -> message -> unit) ->
(Async.Reader.t
* Async.Writer.t
* [ `Stopped_reading of (unit, string) Stdlib.Result.t Async.Deferred.t ]
* [ `Stopped_writing of (unit, string) Stdlib.Result.t Async.Deferred.t ])
Async.Deferred.t
Given a Reader.t
and Writer.t
connected to a peer, return a new Reader.t
and Writer.t
that represents the connection to the peer but that will run f
on any messages that are read or written.
val connect_peers_and_listen :
peer1:Peer.t ->
peer2:Peer.t ->
f:([ `Peer_1_to_2 | `Peer_2_to_1 ] -> message -> unit) ->
([ `Peer1 of (unit, string) Stdlib.Result.t ]
* [ `Peer2 of (unit, string) Stdlib.Result.t ])
Async.Deferred.t
Connect two peers together and listen to the messages that pass between them. Both readers and writers will be closed when either side closes the connection.