Unable to read data from the transport connection : An existing connection was forcibly closed by the remote host

I have a server app and sometimes, when the client tries to connect, I get the following error:

enter image description here

NOTE: the "couldn't get stream from client or login failed" is a text that's added by me in catch statement

and the line at which it stops ( sThread : line 96 ) is :

tcpClient = (TcpClient)client;
clientStream = tcpClient.GetStream();
sr = new StreamReader(clientStream);
sw = new StreamWriter(clientStream);

// line 96:                 
a = sr.ReadLine();

What may be causing this problem? Note that it doesn't happen all the time

85
задан Luke Girvin 23 May 2017 в 14:58
поделиться