Ethernet icon indicating copy to clipboard operation
Ethernet copied to clipboard

library looses incoming packets

Open geetee24 opened this issue 6 years ago • 3 comments

brand new arduino branded ethernet 2 with using your latest code.

my app functions as web server.

when client sends large file, web server gets client.available to false at times due to appears your library cant keep up with incoming http data.

is there a way to not lose packets?

geetee24 avatar Aug 11 '19 16:08 geetee24

It is not unusual for client.available() to return false and this does not indicate the loss of packets.

Your server should wait for client.available() != 0 and implement a timeout so it doesn't hang if the client has stopped sending. For example:

int start = millis(); while (!client.available()) { if (millis() - start > timeout_ms) break; } ... TCP/IP includes a metering mechanism (window size) to prevent buffer overruns; this is handled by the Wiznet Ethernet chips and not the library.

Hope that helps.

SapientHetero avatar Aug 12 '19 16:08 SapientHetero

it does exactly that is is losing chars

On Mon, Aug 12, 2019 at 9:10 AM Sapient Hetero [email protected] wrote:

It is not unusual for client.available() to return false and this does not indicate the loss of packets.

Your server should wait for client.available() != 0 and implement a timeout so it doesn't hang if the client has stopped sending. For example:

int start = millis(); while (!client.available()) { if (millis() - start > timeout_ms) break; } ... TCP/IP includes a metering mechanism (window size) to prevent buffer overruns; this is handled by the Wiznet Ethernet chips and not the library.

Hope that helps.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/arduino-libraries/Ethernet/issues/108?email_source=notifications&email_token=ABS6UT3SQJMVWEIFINRCPO3QEGDQHA5CNFSM4IK4GGQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4DA47I#issuecomment-520490621, or mute the thread https://github.com/notifications/unsubscribe-auth/ABS6UTYZF6IDE4JD3RHL5U3QEGDQHANCNFSM4IK4GGQQ .

geetee24 avatar Aug 12 '19 16:08 geetee24

I don't doubt that your server is losing data; just noting that client.available() == 0 isn't an indication of lost packets.

It would be easier to help if you posted what hardware you're running on and the relevant portions of your code.

SapientHetero avatar Aug 12 '19 16:08 SapientHetero