arduino-libraries / Ethernet

Ethernet Library for Arduino
http://arduino.cc/
259 stars 264 forks source link

EthernetClient::write returns wrong value when buffer size exceeds W5100.SSIZE #141

Open rayshobby opened 4 years ago

rayshobby commented 4 years ago

The return value of EthernetClient::write should be the return value of Ethernet::socketSend: https://github.com/arduino-libraries/Ethernet/blob/75a3c37b5e513305b82e926ca6a4f8190f536c9d/src/EthernetClient.cpp#L86 Otherwise if the buffer to be sent is larger than W5100.SSIZE it will only send W5100.SSIZE number of characters, https://github.com/arduino-libraries/Ethernet/blob/master/src/socket.cpp#L428 yet EthernetClient::write still returns 'size'.

A better way to implement EthernetClient::write is to add a loop until the whole content is sent.