2015-12-29 65 views
1

我正在使用TCP/IP的LWIP堆棧。LWIP堆棧配置

我的應用程序是服務器應用程序。它不斷髮送數據包給客戶端。客戶端沒有任何延遲地接收數據包,但它在200ms後發送ACK。

LWIP堆棧在發送下一個數據包之前總是等待ACK數據包。

是否有任何配置使LWIP堆棧發送數據包而不等待ACK數據包,請讓我們知道。

感謝和問候, Hemanth庫馬爾PG

回答

1

檢查您配置的堆棧的TCP設置什麼樣的價值觀。 默認值位於include/lwip/opt.h中,您應該使用您自己的lwipopts.h對其進行自定義,它們包含在opt.h的頂部,因此會覆蓋任何默認值。

以下值應該對你很有意思。他們有非常保守的默認設置,使LwIP的運行非常低ressources:

/** 
* 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窗口太小,所以堆棧將等待確認能夠發送下一個分組。

這個更多信息可以在LWIP wiki上找到:
http://lwip.wikia.com/wiki/Lwipopts.h
項目主頁:
http://savannah.nongnu.org/projects/lwip/
或郵件列表上:
https://lists.nongnu.org/mailman/listinfo/lwip-users

0

這聽起來你正在運行成Delayed ACK和Nagle算法之間經典的不良交互,在那裏你得到了一個暫時的死鎖延遲ACK計時器的持續時間。這不是LwIP特有的,應用程序可以通過傳統的IP協議棧運行。看到這個問題的詳細信息,下面的鏈接:

根據應用程序的消息格式,您可以通過使用TCP_NODELAY套接字選項關閉Nagle算法解決問題或者通過改變寫入模式以不執行小於最大段大小的後續小寫操作