Reading on a NetworkStream = 100% CPU usage
问题 I am reading from a NetworkStream that is in a while loop. The issue is I am seeing 100% CPU usage. Is there any way to stop this from happening? Here is what I have so far: while (client != null && client.Connected) { NetworkStream stream = client.GetStream(); data = null; try { // Check if we are still connected. if (client.Client.Poll(0, SelectMode.SelectRead)) { byte[] checkConn = new byte[1]; if (client.Client.Receive(checkConn, SocketFlags.Peek) == 0) { throw new IOException(); } } if