简体   繁体   English

Arduino WiFi Shield无法发送整个TCP数据包

[英]Arduino WiFi Shield doesn't send whole TCP packet

I have an Arduino Uno R3 with an Arduino WiFi shield. 我有一个带Arduino WiFi防护罩的Arduino Uno R3。 The WiFi shield has the most current firmware (V1.1.0). WiFi防护板具有最新固件(V1.1.0)。 I am trying to send a packet to the router that is about 900 bytes (the packet is for setting up a UPnP port map). 我正在尝试向路由器发送一个大约900字节的数据包(该数据包用于设置UPnP端口映射)。 This packet is stored in program memory to conserve SRAM. 该数据包存储在程序存储器中以保存SRAM。 Using strcat_P , I can pull the packet from memory into a buffer and send it using the WiFiClient library (TCP). 使用strcat_P ,我可以将数据包从内存中拉到缓冲区中,然后使用WiFiClient库(TCP)发送。

The problem is that I can't send the whole packet. 问题是我无法发送整个数据包。 For testing, I just send the packet to my computer located on the same LAN where I use a packet sniffer to view the packet. 为了进行测试,我只是将数据包发送到位于同一LAN上的计算机,并在其中使用数据包嗅探器查看该数据包。 Using WiFiClient.write(), I get differing performance depending on the size of the buffer I use. 使用WiFiClient.write(),根据所用缓冲区的大小,我会得到不同的性能。 I seem to get the best performance calling WiFiClient.write() with a buffer size of 80 repeatedly until the whole packet has been "sent". 我似乎获得最佳性能,即反复调用80缓冲区大小的WiFiClient.write(),直到整个数据包都被“发送”为止。 Anything greater than about 80 will cause blank packets on the other end. 任何大于约80的值都会在另一端导致空白数据包。 However, with 80, I usually only see about 500 bytes get transmitted. 但是,对于80,我通常只看到大约500字节被传输。 The packet always gets cut off at an arbitrary point. 数据包总是在任意点被切断。 Does anyone know what could be causing this? 有谁知道是什么原因造成的?

I've did a lot of Googling, and I see others having similar problems. 我做了很多谷歌搜索,我发现其他人也有类似的问题。 I have never ran across a solution, though. 不过,我从未遇到过解决方案。

I know this is old, but I recently found this article which addresses the issue you are describing. 我知道这很旧,但是最近发现这篇文章可以解决您所描述的问题。

tl;dr - You can only write 90 bytes at a time to the wifi shield's buffer tl; dr-您一次只能向wifi屏蔽板的缓冲区写入90个字节

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM