Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I use MFC in VC++ in PC.
In my TCP/IP socket communication, my client socket is lost when it met a critical abnormal error and program terminated.

Next, the client program restart to make a new socket to connect to the same server, there are many reset control messages and looping in the Wireshark screen.

I cannot understand the meaning of messages, so let me tell the direct coding methods.

Source Destination Port No. Informations
--------------------------------------------------------------------------------------------
Server -> Client 3999-> 3224 [PSH, ACK] Seq=101743 Ack=11 Win=5840 Len=55
Server -> Client 3999-> 3224 [PSH, ACK] Seq=101798 Ack=11 Win=5840 Len=51
Client -> Server 3224-> 3999 [ACK] Seq=11 Ack=101849 Win=62992 Len=0

In this point PC Client terminated with abnormal error and send following reset message.

Client -> Server 3224->3999 [RST,ACK] Seq=11 Ack=101849 Win=0 Len=0

Next, Client restarted to make a new socket(3361) and to try to communicate with the same Server.

Client -> Server 3361->3999 [SYN] Seq=0 Win=8192 Len=0 MSS=1460 WS=256 SACK_PERM=1

Server -> Client 3999->3361 [RST,ACK] Seq=1 Ack=1 Win=0 Len=0

Client -> Server 3361->3999 [TCP Spurious Retransmission] Seq=0 Win=8192 Len=0 MSS=1460 WS=256 SACK_PERM=1


Server -> Client 3999->3361 [RST,ACK] Seq=1 Ack=1 Win=0 Len=0

Client -> Server 3361->3999 [TCP Spurious Retransmission] Seq=0 Win=8192 Len=0 MSS=1460 SACK_PERM=1

Server -> Client 3999->3361 [RST,ACK] Seq=1 Ack=1 Win=0 Len=0

......


Please let me know the correct code method of this case.

Thank you.

What I have tried:

Over 1 week, I wasted my time of this problem.
Posted
Updated 13-Jun-16 21:39pm

1 solution

After the client has closed the previous connection it tries to open a new one. This attempt is acknowledged (ACK) by the server but not accepted (RST). So the client tries it again which is indicated as "TCP Spurious Retransmission" by Wireshark (the packet itself is a SYN packet identical to those send upon the first attempt).

So the problem is probably located in your server code. Check there if the handle is closed properly (server will return to listen state) and new connections are accepted (accept called again).
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900