Skip to content

Let EthernetServer::write return the number of bytes written to any client #1699

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

Open
wants to merge 1 commit into
base: ide-1.5.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build/shared/revisions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ We suggest to delay the adoption of the new format until a stable 1.5.x is relea
* avr: Fixed timeout in Bridge::transfer()
* sam: Fixed SPI initialization (when using extended API and multiple CS)
* avr: Fixed behavior of EthernetClient::flush()
* avr: Improved return value of EthernetServer::write()

[core]
* sam: Fixed wrong initialization for ADC timings (analogRead speed Arduino DUE improved by a factor x10)
Expand Down
4 changes: 3 additions & 1 deletion libraries/Ethernet/src/EthernetServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ size_t EthernetServer::write(const uint8_t *buffer, size_t size)

if (EthernetClass::_server_port[sock] == _port &&
client.status() == SnSR::ESTABLISHED) {
n += client.write(buffer, size);
size_t res = client.write(buffer, size);
if (res > n)
n = res;
}
}

Expand Down