void sndLoop(Socket socO, BinaryQueue bq, ref bool DoExit) { try { using (var stream = new NetworkStream(socO)) using (var bstream = new BufferedStream(stream)) while (true) { var b = bq.GetBlock(); if (b.Length <= 0) { Thread.Sleep(1); continue; } bstream.Write(b, 0, b.Length); bstream.Flush(); } } catch (Exception e) { //Console.WriteLine("Disconnected"); // throw; } finally { DoExit = true; } }