AnsweredAssumed Answered

TCP child task gets stuck at send()

Question asked by Alvaro Oliveira on May 24, 2019
Latest reply on May 27, 2019 by Daniel Chen

MQX ver. 4.1.1.

I made a daemon server to treat incoming TCP connections as suggested in many posts by NXP mods. I set a limit of connections to 5 using my own solution and that's working alright. The problem i have tho is that sometimes (it's not always and i have to make multiple tests to make it happen) all the child tasks that have a socket each gets stuck at send().

my socket options:

#define TESTSOCKET_BUFFER_SIZE 256
#define TESTSOCKET_NOWAIT FALSE
#define TESTSOCKET_SEND_TIMEOUT 10000
#define TESTSOCKET_CONNECT_TIMEOUT 1000
#define TESTSOCKET_TIMEWAIT_TIMEOUT 1000

 

i'm using a shell script to check if my packages are being recieved:

  for((i=1;i<=5;i++))
  do
    echo msg | netcat 192.168.41.100 22222 > ${i}.log&
  done 

my test child task will send 10 messages in sequence and then shutdown.

 

sometimes the child tasks will get stuck, after about 3min it gets unstuck and it returns the error 0x1635 which means TCP: Software caused connection abort.

Looking further in wireshark, when the stuck occurs it seems the device sends a TCP Zero Window, it seems the device does not have what it takes to send all the messages in a short time, but is there a way to circumvent this?

Outcomes