Hi,
1. The 200ms latency is the default latency of most TCP stack code
because TCP stack always wait for enough data to send to achieve maximum
efficiency.
Even though you send your data in two tcp_write(),
the peer can still posibble read the whole data in only one tcp_read().
You have no way to make sure sent packet and received packet is one-to-one.
2. You can adjust sndbuf size in opt.h
east3
From: ella
Date: 2013-11-12 18:52
To: lwip-users
Subject: [lwip-users] Efficient sending small data packets
I need to send 100 data packets of small (up to 16 bytes) but variable size.
I'm using RAW API TCP server.
1.
My first attempt was to do something like this:
tcp_write( buf1 ... )
tcp_output( ... )
wait for completion
tcp_write( buf2 ... )
tcp_output( ... )
wait for completion
...
It worked but I noticed a relatively big latency (about 200ms or more)
between arrival of buf_n and buf_n+1.
Where does it come from? How lwip stack schedule an actual transmission upon
receipt of tcp_output?
2.
My second attempt was to post all data with tcp_write( buf_n,
TCP_WRITE_FLAG_COPY ) and push it with tcp_output( ... )
It fails on TCP_SND_QUEUELEN check.
Here I have a question about pbufs allocation. Are pbufs allocated
dynamically (like malloc blocks) and why should a number of queue be limited
by number of pbufs and not by total size of lwip memory pool?
Now I do not know what to do. How to send my 100 buffers efficiently?
Thanks.
--
View this message in context:
http://lwip.100.n7.nabble.com/Efficient-sending-small-data-packets-tp22041.html
Sent from the lwip-users mailing list archive at Nabble.com.
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users
-----
在此邮件中未发现病毒。
检查工具:AVG - www.avg.com
版本:2014.0.4158 / 病毒数据库:3629/1 - 发布日期:10/07/13
内部 病毒数据库 已过时。
_______________________________________________
lwip-users mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/lwip-users