private void SendFromQueue()
{
string message = null;
lock (queue)
{
if (!IsSending && queue.Count > 0)
message = queue.Dequeue().ToString();
}
if (message != null)
{
try
{
byte[] toSend = Encoding.UTF8.GetBytes(message).Concat(new byte[] { 0x0 }).ToArray();
_stream.BeginWrite(toSend, 0, toSend.Length, WriteCompleted, _stream);
}
catch
{
}
}
}