I would like to clear the socket read buffer so that I write the following code ...
byte[] tempBuffer = new byte[1024];
int readCount = 0;
while ((readCount = tcpSocket.GetStream().Read(tempBuffer, 0, tempBuffer.Length)) != 0)
{
}
But the Read () method is locked, so I added tcpSocket.ReceiveTimeout = 1; . And it works the same as before.
As I know, this is commonly used in C ++. How can I solve this problem?
source
share