Skip to content

Increase socket buffer size to the maximum WINC1500 transfer size #116

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

Merged

Conversation

sandeepmistry
Copy link
Contributor

This resolves arduino-libraries/ArduinoHttpClient#14 for me - still need to understand why.

cc/ @creends

@sandeepmistry
Copy link
Contributor Author

The regression in arduino-libraries/ArduinoHttpClient#14 was introduced by #91 (the fix for #86).

On non-AVR boards, SOCKET_BUFFER_MTU and SOCKET_BUFFER_TCP_SIZE are both set to 1400. With the current code the WINC1500 sends a 1400 byte chunk of data, then the next 46 bytes. After this 258 bytes come in, however since the full flag is not set, it overwrites the data at index 0 (same index of the previous 46 bytes), and causes the buffer to become corrupt.

Alternatives to the changes proposed in this PR:

  1. Revert the changes from Do not set full flag if remaining size if 0 #91, but this will re-introduce WiFi.status() == WL_CONNECTED although connection lost and WiFi.RSSI() == 0 #86.

or

  1. Change SOCKET_BUFFER_MTU to 1446 and make SOCKET_BUFFER_TCP_SIZE 723. Will still probably re-introduce WiFi.status() == WL_CONNECTED although connection lost and WiFi.RSSI() == 0 #86.

@sandeepmistry
Copy link
Contributor Author

From @creends in arduino-libraries/ArduinoHttpClient#14 (comment)

So #116 works fine for me too.
No more unwanted characters at the end of the answers, and whole responses for the longer ones.
Thank you for your help.

Great, thanks for trying it out! I think we can merge this and tag a new release ...

@akash73 @agdl what do you think? It also solves #115 for me.

@akash73
Copy link

akash73 commented Nov 29, 2016

LGTM, nice.
@agdl , if it's ok to you, pls merge.

@sandeepmistry sandeepmistry merged commit f31eb22 into arduino-libraries:master Nov 29, 2016
@sandeepmistry sandeepmistry deleted the bump-socket-buffer-mtu branch November 29, 2016 14:22
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

Successfully merging this pull request may close these issues.

responseBody() doesn't work when the lenght of the response is larger than 1500
2 participants