我正在为TCP/IP使用LWIP堆栈。
我的应用程序是服务器应用程序。它不断地向客户端发送数据包。客户端不加延迟地接收数据包,.But在200 it后发送给客户端。
LWIP堆栈总是在发送下一个数据包之前等待ACK数据包。
是否有任何配置,使LWIP堆栈发送数据包,而不等待ACK包,请告诉我们。
谢谢和问候,Hemanth Kumar PG
发布于 2016-02-09 12:01:06
检查为堆栈的TCP设置配置了哪些值。默认值位于include/lwip/opt.h中,您应该使用自己的lwipopts.h对其进行自定义,这将包含在opt.h的顶部,从而覆盖任何默认值。
下面的值对您来说应该是有趣的。它们具有非常保守的默认设置,可以使LwIP在非常低的资源上运行:
/**
* TCP_MSS: TCP Maximum segment size. (default is 536, a conservative default,
* you might want to increase this.)
* For the receive side, this MSS is advertised to the remote side
* when opening a connection. For the transmit size, this MSS sets
* an upper limit on the MSS advertised by the remote host.
*/
#ifndef TCP_MSS
#define TCP_MSS 536
#endif其他值主要是从这个值计算出来的:
/**
* TCP_WND: The size of a TCP window. This must be at least
* (2 * TCP_MSS) for things to work well
*/
#ifndef TCP_WND
#define TCP_WND (4 * TCP_MSS)
#endif
/**
* TCP_SND_BUF: TCP sender buffer space (bytes).
* To achieve good performance, this should be at least 2 * TCP_MSS.
*/
#ifndef TCP_SND_BUF
#define TCP_SND_BUF (2 * TCP_MSS)
#endif
/**
* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
* as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work.
*/
#ifndef TCP_SND_QUEUELEN
#define TCP_SND_QUEUELEN ((4 * (TCP_SND_BUF) + (TCP_MSS - 1))/(TCP_MSS))
#endif您正在体验的是TCP窗口太小,因此堆栈将等待ACK才能发送下一个数据包。
有关此问题的更多信息可以在LWIP wiki中找到:
http://lwip.wikia.com/wiki/Lwipopts.h
项目首页:
http://savannah.nongnu.org/projects/lwip/
或在邮寄名单上:
发布于 2016-04-19 20:54:00
这听起来您正在遇到延迟ACK和Nagle算法之间的典型的糟糕交互,在这里您会得到一个临时死锁,即延迟的ACK计时器的持续时间。这并不是LwIP特有的,应用程序可以在传统的IP堆栈中运行。有关此问题的更多信息,请参见下面的链接:
根据应用程序消息格式的不同,可以通过使用TCP_NODELAY套接字选项关闭Nagle的算法或更改写入模式以不执行小于最大段大小的后续小写入来解决此问题。
https://stackoverflow.com/questions/34520921
复制相似问题