try { while (socket.Available == 0) System.Threading.Thread.Sleep(1); } catch (ObjectDisposedException) { return; }