Small bug in EthernetClient write

Status
Not open for further replies.
Not sure if this is the most appropriate place to post this but there is a small bug in the standard ethernet library.
The write function in EthernetClient returns the wrong size. If any bytes were written it claims to have written all the bytes.

Here is the corrected code beginning on line 83 of EthernetClinet.cpp:

Code:
size_t EthernetClient::write(const uint8_t *buf, size_t size)
{
  if (sockindex >= MAX_SOCK_NUM) return 0;
  //if (Ethernet.socketSend(sockindex, buf, size)) return size; // wrong size returned
  if (size = Ethernet.socketSend(sockindex, buf, size)) return size; //returns size returned by socketSend
  setWriteError();
  return 0;
}
 
Status
Not open for further replies.
Back
Top