<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Mpd__Connection_lwt (libmpdclient.Mpd__Connection_lwt)</title><link rel="stylesheet" href="../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> â€“ <a href="../index.html">libmpdclient</a> &#x00BB; Mpd__Connection_lwt</nav><h1>Module <code>Mpd__Connection_lwt</code></h1><p>Offer functions and type in order to handle connections to the mpd server at the socket level in Lwt thread.</p></header><dl><dt class="spec type" id="type-t"><a href="#type-t" class="anchor"></a><code><span class="keyword">type </span>t</code></dt><dd><p>Lwt connection type for thread usage</p></dd></dl><dl><dt class="spec exception" id="exception-Lwt_unix_exn"><a href="#exception-Lwt_unix_exn" class="anchor"></a><code><span class="keyword">exception </span></code><code><span class="exception">Lwt_unix_exn</span><span class="keyword"> of </span>string</code></dt><dd><p>Custom exception.</p></dd></dl><dl><dt class="spec value" id="val-initialize"><a href="#val-initialize" class="anchor"></a><code><span class="keyword">val </span>initialize : string <span>&#45;&gt;</span> int <span>&#45;&gt;</span> <a href="index.html#type-t">t</a> Lwt.t</code></dt><dd><p>Create the connection in a Lwt thread, throws an exception Mpd_Lwt_unix_exn of string when an error occurs.</p></dd></dl><dl><dt class="spec value" id="val-hostname"><a href="#val-hostname" class="anchor"></a><code><span class="keyword">val </span>hostname : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> string Lwt.t</code></dt><dd><p>Get the hostname of the current connection.</p></dd></dl><dl><dt class="spec value" id="val-port"><a href="#val-port" class="anchor"></a><code><span class="keyword">val </span>port : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> int Lwt.t</code></dt><dd><p>Get the port of the current connection.</p></dd></dl><dl><dt class="spec value" id="val-buffer"><a href="#val-buffer" class="anchor"></a><code><span class="keyword">val </span>buffer : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> string Lwt.t</code></dt><dd><p>Get the buffer used by the connection.</p></dd></dl><dl><dt class="spec value" id="val-recvbytes"><a href="#val-recvbytes" class="anchor"></a><code><span class="keyword">val </span>recvbytes : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> Stdlib.Bytes.t Lwt.t</code></dt><dd><p>Read from the connection.</p></dd></dl><dl><dt class="spec value" id="val-write"><a href="#val-write" class="anchor"></a><code><span class="keyword">val </span>write : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> int Lwt.t</code></dt><dd><p>Write in a Mpd connection throught a Lwt thread. It fails with an exception Mpd_Lwt_unix_exn of string.</p></dd></dl><dl><dt class="spec value" id="val-close"><a href="#val-close" class="anchor"></a><code><span class="keyword">val </span>close : <a href="index.html#type-t">t</a> <span>&#45;&gt;</span> unit Lwt.t</code></dt><dd><p>Close the connection.</p></dd></dl></div></body></html>