分享

lwip

 杰杰梅梅一生一世 2013-05-14

Hi all,

 

 

I have a problem that I have seen lots or users straggling with, but without any real solution.

 

I am trying to send data in a loop. I have triad closing NAGLE  as follows:

 

  // this should shut down the NAGLE algorithm

  pcb->flags |= TF_NODELAY | TF_ACK_NOW;

 

 

I am calling tcp_output() on every tcp_write() but this does not help as well. I got ERR_MEM

after the 20th something call to tcp_write()

 

 

I managed to find in one of the answers here that I should use a smaller window, meaning

change the settings in lwipopts.h… So I did, and it was a bit better.

 

/* TCP Maximum segment size. */

//#define TCP_MSS                         1460

#define TCP_MSS                         512

 

/* TCP sender buffer space (bytes). */

//#define TCP_SND_BUF                     (3*TCP_MSS)

#define TCP_SND_BUF                     (8*TCP_MSS)

 

 

Well the above helped and I was able to send more small packets but after 32 instead of 20 it again

It stopped sending and I got ERR_MEM.

 

The most important thing is when I check wireshark I see that the stack is sending all my data in one

Frame ???

 

 

Now can someone explain what is going on ?

 

For every call to tcp_write the enqueue mechanism is advancing  snd_queulen by one !

 

I see two problems here. If the stack eventually sends all these in one TCP packet why is snd_queulen incremented at all ??

 

Secondly if I use  pcb->flags |= TF_NODELAY  why is the stack adding all the data into one packet ??

 

 

Your input is more than welcomed.

 

 

BR,

Noam.

 





************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists./mailman/listinfo/lwip-users

RE: enqueing problem

Kieran Mansley
1951 posts
On Sun, 2011-03-27 at 15:40 +0200, Noam weissman wrote:
>
> I do understand that on every call to tcp_write the snd_queuelen is
> incremented but I do not understand why it is not
> decremented when I call  tcp_output. Also take into consideration that
> I have closed NGLE so it should have worked ??

I think there's a little confusion here.  Simon said "The only thing
changed by disabling nagle is that tcp_output always sends everything
that is enqueued." but this isn't quite right.  Disabling Nagle's
algorithm stops us delaying transmission when there are small writes and
packets are already in flight.  It doesn't stop us delaying transmission
for other reasons, so tcp_output() won't always send everything that is
enqueued.  For example, if we have run out of congestion window or
receive window we will be unable to send immediately.  I think this will
explain what you see, particularly as the initial value for the
congestion window is quite small.

A packet capture would be useful to see what is happening on the wire.
Detail about how large your sends are would also help.

Kieran


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists./mailman/listinfo/lwip-users

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多