Why connection to the server to connect to the client server is disconnected

I have a client server client application in C # .NET using Sockets.

I often get log messages (say, about 4 per hour) saying this message,

An existing connection was forcibly closed by the remote host 

In this case, an error occurs on the server side.

I decided to use wirehark to analyze what is happening and I get this. There are no delays, all this happens in a couple of seconds.

 Server > Client [PSH, ACK] Seq=55653 Ack=4472 Win=63940 Len=148 Client > Server [ACK] Seq=4472 Ack=55801 Win=4038 Len=0 Server > Client [PSH, ACK] Seq=55801 Ack=4472 Win=63940 Len=148 Client > Server [ACK] Seq=4472 Ack=55949 Win=4001 Len=0 Server > Client [PSH, ACK] Seq=55949 Ack=4472 Win=63940 Len=142 Client > Server [PSH, ACK] Seq=4472 Ack=55949 Win=4001 Len=31 Client > Server [RST, ACK] Seq=4503 Ack=55949 Win=0 Len=0 

Thus, the client and server send things between themselves (PSH) and confirmation data (ACK). RST suddenly appears. This according to wikipedia is reset, and this reset corresponds to the message "Existing connection was forced ...", which I received above.

What does it mean? Does this mean that the reset problem is causing the problem? I think the answer to this question is negative, and what would be more reasonable is that reset is the result of the problem? That is, the socket on the server side dies for some reason, and the client sends a reset to the server to try and wake it up.

Thoughts?

+4
source share
2 answers

Sometimes an unsuccessful client receives or sends what it wants, then immediately terminates (closes the socket and abruptly terminates the connection). It's normal to see that sometimes on any service that works on the Internet.

If this is your own code that causes this, make sure you send the “I'm done now” command (the general one is “QUIT”) and correctly “turn off” the connection before closing it. On top of that, the only discards you have to trigger will mean that your internet access is falling out.

+1
source

Are the server and client your own code. Even I encountered a similar problem, but in my case the server was not my code, so I could not find out why the client closes the connection and sends PSH and RST messages.

In any case, if you get an error message similar to the one you have, you can create a new socket and establish a connection.

0
source

Source: https://habr.com/ru/post/1313465/


All Articles