lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] tcp_write problem after the first transmission


From: address@hidden
Subject: Re: [lwip-users] tcp_write problem after the first transmission
Date: Wed, 27 Jan 2010 17:14:09 +0100
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.1.7) Gecko/20100111 Thunderbird/3.0.1

As a side note, I hope you are calling the loop below in the tcpip_thread, not from another application thread, which would violate lwIP threading.

Aside from that, what Bernhard said is true: the packets are buffer for retransmission until they are ACKed by the remote side, which cannot happen while you are in the loop. As a result, you either have to bufer your data somewhere else and call tcp_write() from the 'poll' or 'sent' callback - or increase TCP_SND_QUEUELEN to 20 (in your case, depends on your application) to be able to internally queue as much data as you have to at maximum.

Simon


Daniel Berenguer wrote:
I'm trying to send a bunch of TCP packets using the raw API but
tcp_write is returning -1 (out of memory) after the 8th packet.

for (i=0 ; i<20 ; i++)
{
     strcpy(buffer, "holaaa");
     res = tcp_write(pcb, buffer, 7, 0);
     tcp_output(pcb);
}

I've used many variants of the above code (with delays, w/o
tcp_output, ...) but the problem is always there. The first packet is
sent immediately after the first tcp_write but then, tcp_write just
pushes the packets into the sending queue. TCP_SND_QUEUELEN is set to
8 so once the TX queue gets overflowed tcp_write starts returning -1
and the contents of the queue is finally sent (only 7 packets of 20
though).

Any idea?

Thanks.


_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users






reply via email to

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