[En-Nut-Discussion] Tcp receiving buffer problem

Bernd Walter enut at cicely.de
Tue Jul 14 11:40:24 CEST 2009


On Mon, Jul 13, 2009 at 11:18:48PM -0700, piotrbocian wrote:
> 
> I have a following problem. I use an IP camera, which non-stops sends a
> stream of jpg pictures via tcp to Atmega128.
> When I'm receiving these pictures every several seconds, everything is OK,
> however when I'm trying to receive a next picture after a while (about 30
> seconds) program crashes (I get the same value of one byte non-stop or i
> don't get anything).
> 
> I suppose that a problem is in a tcp buffer, which can receive only a
> limited number of bytes, and it rejects further bytes or it breaks at all.
> 
> Temporarily I made up, to create thread which receives bytes from tcp all
> the time (to purge buffer) and it works, but it is very inefficient to get
> 512 unnecessary bytes every 125 ms.
> 
> Is my theory about blocking up a tcp buffer true, and is there any better
> solution of this problem?

This might be the zero window probe problem, which I told on the list
a while back.
The problem arises when you have a receiving TCP sockets, a sender,
which has sending bytes in the queue and you don't take them for a while.
Ethernut currently doesn't enforce the receive window, so every client
ignoring it can fill up your free memory.
Zero window probe are packets, which a peer sends to test if the zero
window condition is still valid, but it works by intentionally ignoring
your receive window.

As a first check into the direction you should check if free memory is
decreasing over time.

-- 
B.Walter <bernd at bwct.de> http://www.bwct.de
Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.



More information about the En-Nut-Discussion mailing list