I'm using MK64FN1M0VMD12,and read data from server by LWIP running on FreeRTOS.
LWIP version:2.2.0
FreeRTOS kernel version:10.2.0
The server sends data to client by TCP every one second.When the data transfers at the rate of about 100bps,it works well for a long time.
But a timeout occurs when the speed is larger than 200bps.At this moment,lwip_read will always timeout,and reconnecting TCP will always fail until you reboot the system.
Sometimes it can only receive 2000 bytes then a timeout occurs,but sometimes it can receive more than 100000 bytes then a timeout occurs.
the code is roughly like this:
socket = socket(AF_INET, SOCK_STREAM, 0);
connect(socket, (struct sockaddr *)&addr, sizeof(struct sockaddr));
setsockopt(socket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
/* write to the server to request sending messages to client every second */
write(socket, buf, len);
/* */
while(1)
{
read(socket, buf, BUF_SIZE);
}
What is the most likely cause of the problem?
Solved! Go to Solution.
Hi @jake111,
There could be a lot of causes for this timeout issue. Are you using a custom board or the evk for the MK64? Is this implementation yours, or are you utilizing an example? If it is, could you please try an example from the SDK and tell me if the problem is still present?
The lwip_enet_iperf3 example provides basic commands to measure performance of network stack. With this example, you can get an idea of how much throughput your device provides with your characteristics. Could you please test this and tell me how much throughput you get?
The timeout error could be caused by the physical connection of your circuits being damaged, so please take that into consideration aswell.
I hope you find this helpful!
Best regards, Julian
Hi @jake111,
There could be a lot of causes for this timeout issue. Are you using a custom board or the evk for the MK64? Is this implementation yours, or are you utilizing an example? If it is, could you please try an example from the SDK and tell me if the problem is still present?
The lwip_enet_iperf3 example provides basic commands to measure performance of network stack. With this example, you can get an idea of how much throughput your device provides with your characteristics. Could you please test this and tell me how much throughput you get?
The timeout error could be caused by the physical connection of your circuits being damaged, so please take that into consideration aswell.
I hope you find this helpful!
Best regards, Julian