Module NetTcp.Connection

module Connection: sig .. end

type t 
Connection to a remote process or machine
val address : t -> NetTcp.Address.t
val try_open : NetTcp.Address.t -> t option Lwt.t
Connection to a remote machine or process by its address.
Returns a connection or None
val close : t -> unit Lwt.t
Close connection
val is_closed : t -> bool
Connection closed?
val wait : t -> unit Lwt.t
Wait for the connection to close
val finalize : t -> unit
Add a finalizer on the connection so that it's closed when it's garbage collected
val send : t -> Bencode.t -> unit
Send a message to the remote machine. The message will normally not be modified during transport, but it may be lost (for instance if the network cable is cut...)
val events : t -> Bencode.t Signal.t
Events: received messages, sent by the remote side
val local : int -> t option Lwt.t
val by_host : string -> int -> t option Lwt.t
val by_name : string -> int -> t option Lwt.t
use DNS to resolve the given address, then call NetTcp.Connection.by_host
val of_sock : Lwt_unix.file_descr -> NetTcp.Address.t -> t
Build a connection from a given filedescriptor