Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.4.0-rc1 WiFiClient::write() function fails if more than 1460 bytes is sent to a remote-server #3448

Closed
Rob58329 opened this issue Jul 22, 2017 · 0 comments

Comments

@Rob58329
Copy link

Rob58329 commented Jul 22, 2017

Hardware: Wemos D1 mini
Core Version: 2.4.0-rc1 (via ArduinoIDE Boards Manager on a Windows-PC)

Update: The below 1460 byte packet-limit issue was actually due to the MTU of the internet-connection being used (UK-broadband &/or 4G). As detailed below, the ESP8266 successfully transmitted packets larger than this when connecting to a server on the local network, so would appear to be working successfully!

(The issue does not appear with the 2.3.0 software version, as this latter esp8266-software-version can only handle 1460byte (or smaller) packets, so you could only send this size packet anyway!)

**** ie. RESOLVED! ****

Description:
If using the 2.4.0-rc1 release-candidate software version, the WifiClient .write(array,size) function does not correctly send out the complete (array) if connected with a remote-server, when the (array) is larger than 1460 bytes.

IE using:
WiFiClient.client;
client.connect(address,port);
{client.write(array1,size); client.read();} // repeated successfully for small "array1"-sizes ("reading" the appropriate reply) about 14 times
client.write(array2big,size); // "array2big" size of 1460 characters works, BUT...
// "array2big" size of 1461 (or more) characters gets corrupted (is not received correctly by the remote server)

In my case I am sending email-data to a remote SMTP:25 server, and the remote-email-server never receives the end of the "array2big".

Notes:
(1) HOWEVER, if I send the same email-data to a local SMTP:25 server on my local network, then it works fine (and I get the full "array2big" - which also works on my local network if "array2big" is 2024+ characters).
(2) Also note that if I change back to Software-Core-Version-2.3.0 again, I can send "array2big" with upto >2024bytes approx of data to my remote-server fine.
(3) Also note that putting a "delay(5000)" (5 seconds) before the "client.write(array2big,size)" makes NO DIFFERENCE to the data-size I can send successfully.

I note that in "WifiClient::write refactoring (second attempt) 2177" (#2177) igrr has detailed some of the "WiFiClient" changes, and says that this 2.4.0-rc1 version has removed the (2*1460) limit of the earlier version and allowed the "WiFiClient" to send more. BUT it appears to me that this ONLY works if sending to local-servers, and FAILS (by truncating or corrupting the data somehow) if sending more that 1460 characters to a remote-server.

In addition, trying to "client.write()" anything after this 1461-character array never gets any response from the remote-server, so I suspect that the client.write() fuction might have got corrupted (requiring a "client.stop" and "client.connect" process to reset it)??

I also note that the same issue occurs in the [WiFiClientSecure::write] function, except that in this case arrays of 1390bytes work, but 1395bytes fail (the difference between this and 1460 is probably the encryption overhead).

Finally, from the notes in (#2177), and the 1460 limit I am seeing, this might be something to do with how much is written to the TCP stack, and what is done if an acknowledgement is not received immediately after the first 1460 bytes??

@Rob58329 Rob58329 closed this as completed Oct 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant