[Top][All Lists]

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

Re: [lwip-users] tcp echo example

From: M. Manca
Subject: Re: [lwip-users] tcp echo example
Date: Fri, 01 Aug 2014 22:42:33 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Il 01/08/2014 20:35, Sergio R. Caprile ha scritto:
when you say "echo example", do you mean the echo example in the contrib
tree or some vendor distributed (and probably modified) file ?
'cause i've run the echo example from the 1.4.1 contrib tree some weeks
ago and I don't recall seeing anything strange.
And btw, I don't see anything close to what you are describing in that
code, and there is only one tcp_write() call in echo.c:

address@hidden ~]$ grep -n tcp_write
311:  wr_err = tcp_write(tpcb, ptr->payload, ptr->len, 1);
yes, it isn't the only one directly called but if you search for echo_send() you will find it in echo_recv(), echo_poll(). echo_sent().

The code is exactly that, the port is that for LPC176x. The port is working perfectly but every echo message is sent 2 times, the 1st is correct but the second call to tcp_write() cames from the call to echo_send() inside echo_sent(). Debugging the situation I found that pbuf_free() is correctly called but the pointer to pbuf (es->p) is not NULL.

So seems that the effect of the problem is quite clear but is not clear why.

What I can say is that if I want to send a message, it will be copied to a pbuf and this pbuf in some way will be only enqueued to be transmitted, right?

Supposing that I write 3 messages, I should call tcp_write() 3 times so at least 3 pbufs will be enqueued. Considering that messages are really sent calling tcp_output() that it is called in tcp_fasttmr() and in tcp_slowtmr() I really don't understand why inside the sent callback the pbuf pointer is checked and the message re-sent if the pointer is not null... that it is the last message enqued and this doesn't mean that it is always the 1st message that will be sent.

I simply think that the call to echo_send() inside the sent callback is totally wrong .

BTW, if you want to really test the net throughput (or at least come
closer) get the netio patch: https://savannah.nongnu.org/patch/?7026



Massimo Manca
, Micron Engineering

via della Ferriera, 48 33170 Pordenone PN ITALIA
Tel: 39 0434 1856131 | Mobile: 39 349 4504979
Twitter LinkedIn SlideShare
Contact me: Skype micron.engineering

Questa e-mail è priva di virus e malware perché è attiva la protezione avast! Antivirus .

Attachment: m_manca.vcf
Description: Vcard

reply via email to

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