[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Failing to call tcp_write 10 times per second

From: Хазанский Роман
Subject: [lwip-users] Failing to call tcp_write 10 times per second
Date: Fri, 18 Jan 2019 00:10:50 +0300

I'm using LWIP Stable 2.0.3 in uVision Keil 5.23 with armcc compiler, 
Cortex-M0 MCU, raw API.

My code is waiting for incoming TCP connection and then starts to send 
packets to the 'client'. Basically, I'm doing multiple calls to 
tcp_write with more or less equal intervals. I couldn't find any info 
that suggested this would be wrong or that I shall wait for previous 
tcp_write to be completed, so I went with it.

I'm sending rather small packets, about 50 bytes each.

It works well until time interval between consequent calls to tcp_write
is around 1 second. But when I try to call tcp_write more frequently,
something breaks and I get a lot of zeros glued to the end of my packet.

I see those zeros in the input array of the function that does actual 
ethernet frame sending.

After adding a lot of debug printing I saw that everything works if 
tcp_write calls are infrequent enough for every packet to get its 
own ethternet frame and is be sent separately.
But I need to send them at least 10 times per second.

I thought that consequent packets would be somehow queued and maybe 
even sent in the same ethernet frame. But for some reason this doesn't 

Please, tell me, what am I doing wrong and how to fix this!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]