public void Write(byte[] buffer, int offset, int length)
{
if (!m_conn.IsConnected) return;
try
{
//doing syncronous writes (to an Asynchronous pipe) seems to be a bad thing
m_conn.BeginWrite(buffer, offset, length, (r) => { m_conn.EndWrite(r); }, null);
}
catch (System.IO.IOException)
{
Disconnect();
}
}