Module Mpd.Connection_lwt

type t

Lwt connection type for thread usage

exception Lwt_unix_exn of string

Custom exception.

val initialize : string -> int -> t Lwt.t

Create the connection in a Lwt thread, throws an exception Mpd_Lwt_unix_exn of string when an error occurs.

val hostname : t -> string Lwt.t

Get the hostname of the current connection.

val port : t -> int Lwt.t

Get the port of the current connection.

val buffer : t -> string Lwt.t

Get the buffer used by the connection.

val recvbytes : t -> Stdlib.Bytes.t Lwt.t

Read from the connection.

val write : t -> string -> int Lwt.t

Write in a Mpd connection throught a Lwt thread. It fails with an exception Mpd_Lwt_unix_exn of string.

val close : t -> unit Lwt.t

Close the connection.