AnsweredAssumed Answered

Tcp retransmission from connected socket

Question asked by Emanuele Trapani on Mar 22, 2016
Latest reply on Dec 4, 2018 by fiction 张


i use mqx 4.2, cw 10.6, frdmk64f. My problem is that i see some unexpected retrasmission packet.

Some time ago i had a similar problem ( that i solved setting a global variables (_TCP_rto_min = 250;) thanks at Mr Musich Cuevas.

Now the problem concern a socket connected to a remote endpoint by a call to connect(). I attach the code i used to reproduce this problem and the wireshark capture that show it.

The code is very simple: i bind the frdm ip at (the ip of my pc is, i create a socket and connect it to my pc. In my pc i use hercules tool with tcp server listening on a determined port. The application, every 5 second, send a packet to the pc, 32 bytes. In wireshark i see that there is a retransmission packet for almost every packet i sent and it is, temporally, very near the packet originally sent.



this is the FSM of the code

while(1){         switch(phase){         case 0:             TCP2SERservsock=socket(PF_INET, SOCK_STREAM, 0);             if (TCP2SERservsock == RTCS_SOCKET_ERROR){                 fputs("\n\r Error: Unable to create socket", stderr);             }             phase=1;             break;                      case 1:             connect(TCP2SERservsock,&TCP2SERaddresses,sizeof(TCP2SERaddresses));             connected=1;             phase=2;             break;                      case 2:             _time_delay(5000);             retval = send(TCP2SERservsock,buffer,32,0);             if(retval==RTCS_ERROR){                 phase=3;             }             buffer[31]++;             break;                      case 3:             chiudisocket(TCP2SERservsock,0);             connected=0;             phase=4;             break;                      case 4:             _time_delay(3000);             phase=0;             break;                  }         _time_delay(1);     }



Emanuele Trapani

Original Attachment has been moved to:

Original Attachment has been moved to: