AnsweredAssumed Answered

Ethernet TCP, delay on send()

Question asked by arnogir on Apr 16, 2015
Latest reply on Jan 4, 2016 by arnogir


I'm working on the tower K60n512 with MQX4.1.1.


I init the RTCS like following:


setsockopt(.. SOL_TCP, OPT_SEND_NOWAIT, true..) 
setsockopt(.. SOL_TCP, OPT_SEND_TIMEOUT, 10..)



Then in cyclic task (5s) I call

send(.., buffer, 5) with buffer is a counter incremented on each send call.

I make toggle a pin just before call send(). After check with oscilloscope, the call to "send()" is really done every exactly each 5s.


I link Ethernet to my laptop with wireshark.

The received frame is not cyclic of 5s. Sometime a delay of 2s can occurs!


32 14:48:58.708895000       TCP 60 502?60226 [PSH, ACK] Seq=61 Ack=1 Win=4380 Len=5
33 14:48:58.926112000       TCP 54 60226?502 [ACK] Seq=1 Ack=66 Win=16428800 Len=0

34 14:49:03.571633000       TCP 60 502?60226 [PSH, ACK] Seq=66 Ack=1 Win=4380 Len=5
35 14:49:03.574697000 Dell_02:63:cd IcannIan_a8:01:7d ARP 42 Who has Tell
36 14:49:03.777609000       TCP 54 60226?502 [ACK] Seq=1 Ack=71 Win=16427520 Len=0

37 14:49:04.573087000 Dell_02:63:cd IcannIan_a8:01:7d ARP 42 Who has Tell
38 14:49:04.573365000 IcannIan_a8:01:7 d Dell_02:63:cd ARP 60 is at 00:00:5e:a8:01:7d

39 14:49:10.081473000       TCP 60 502?60226 [PSH, ACK] Seq=71 Ack=1 Win=4380 Len=5
40 14:49:10.298146000       TCP 54 60226?502 [ACK] Seq=1 Ack=76 Win=16426240 Len=0
41 14:49:12.086411000       TCP 60 [TCP Retransmission] 502?60226 [PSH, ACK] Seq=71 Ack=1 Win=4380 Len=5
42 14:49:12.086479000       TCP 54 [TCP Dup ACK 40#1] 60226?502 [ACK] Seq=1 Ack=76 Win=16426240 Len=0

43 14:49:13.571434000       TCP 60 502?60226 [PSH, ACK] Seq=76 Ack=1 Win=4380 Len=5
44 14:49:13.777004000       TCP 54 60226?502 [ACK] Seq=1 Ack=81 Win=16424960 Len=0


Twrk60 has ip =

Laptop has ip =


I see a good frame #32 and #33 (Request from tower/ Ack from laptop)

Same for #34 and 36

But the #39 should arrive at time 14:49:08.xxxx ut arrive at 14:49:10.xxxx so there are in late! (very late! 1s...)


#43/#44 has the good time.

I don't understand why this frame is send with this late,  why Retransmission is done 2s later? (#41)


For my application, I would have to send frame with a very speed (every 10 or 100ms...) but with simple test (one frame every 5s) sometime some frame are very delayed!.

Have you an idea why?

Note: nothing else is done on K60. Only Ethernet load the µC..