Dear community,
In short:
Basically I’m experiencing that sending data continously from two sockets contemporarly does not work well in FreeRTOS, as it produces lot’s of spuriouse retransmissions and the packet stream lags a lot.
Can anybody confirm this behaviour?
Detailed description:
I am using FreeRTOS V10.2.1 on a Zynq platform (ARM Cortex A9) with the FreeRTOS Plus TCP/IP stack V2.4.0.
In my test scenario I create two TCP sockets that are both configured as servers and bind on different ports (10000 & 20000).
The application consists of a task that sends a continuous stream of packets to connected client, for each socket. The sockets are serviced (written to) in the same task, one after another. The packets are sent at a 100 ms rate for each socket (10 Packets / second / socket).
After sending a packet on each socket the task just sleeps until the 100 ms expired.
There are no other active tasks.
The priorities are defined as such:
#define tskIDLE_PRIORITY ( 0 )
#define configMAX_PRIORITIES ( 7 )
#define ipconfigIP_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) //Highest
#define mainTASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
The packets sent by the servers are very short and have the following format:
typedef struct __attribute__((packed))
{
char frameStart[3]; //a random string like "sta"
uint32_t serialNum; // an upcounting number, is increased for each packet sent
uint8_t dummy[16]; // some random data
}ipstack_perf_payload_t;
The client side is a minimalistic python program on Windows 10 that connects as a client to each server and just prints out the serial number.
client.py.zip (774 Bytes)
Client and server are connected through a LAN cable with now switches in between.
When sending a stream of packets from both sockets, the data stream is interrupted randomly, repeatedly for a few seconds and I get a load of TCP spuriouse retransmissions in wireshark.
When trying the same with a single socket I don’t get any retransmissions at all, even when sending with up to 2 ms rate.
Can sombody explain this behaviour?
I’ll attach the wireshark trace and the FreeRTOSIPConfig.h
WiresharkTrace.zip (8.0 KB)
FreeRTOSIPConfig.h (20.9 KB)
To not make this post even longer and more confusing I opted to leave out the testcode in FreeRTOS for now which really only consists of two sockets being created as TCP servers and waiting for a client to start streaming data. But if you’d still like to see it I’ll attach it in a reply.
If any additional informations are needed to verify/reproduce the behaviour please don’t hesitate to ask.
Thanks for your time!