Ethernet Library for Arduino http://arduino.cc/
  • C++ 95.3%
  • C 4.7%
Find a file
vratk0529-arch-desktop 5d3fac7abf Bound the hanging waits, add DHCP hostname and NTP server
Send and flush spun forever when the peer became unreachable (cable
pulled, peer moved to another network): the socket stays ESTABLISHED,
the chip never transmits, so it never times out either. socketSend(),
socketSendUDP() and EthernetClient::flush() now give up after 250 ms,
and the two read-until-stable register loops after 16 reads. A timed
out send returns 0, which callers already treat as a failed write.

Ethernet.setHostname() replaces the hard-coded "WIZnet" + MAC DHCP
hostname, so the router's lease list says what the device is.

DHCP now requests option 42; Ethernet.ntpServerIP() returns the first
NTP server offered, or 0.0.0.0.

ETHERNET_FORK_VRATK0529 lets code detect this fork.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 00:27:35 +02:00
.github Bump arduino/arduino-lint-action from 2 to 3 2026-07-02 15:32:12 +00:00
docs api.md - fix documenation of client.connect 2023-11-16 11:19:39 +01:00
examples Correct typos in documentation 2022-02-21 20:41:09 -08:00
src Bound the hanging waits, add DHCP hostname and NTP server 2026-09-27 00:27:35 +02:00
.codespellrc Add CI workflow to check for commonly misspelled words 2021-04-12 02:07:25 -07:00
AUTHORS change links to https if possible (#66) 2021-10-04 11:18:42 +02:00
keywords.txt Bound the hanging waits, add DHCP hostname and NTP server 2026-09-27 00:27:35 +02:00
library.properties Bound the hanging waits, add DHCP hostname and NTP server 2026-09-27 00:27:35 +02:00
README.adoc Bound the hanging waits, add DHCP hostname and NTP server 2026-09-27 00:27:35 +02:00

:repository-owner: Vratk0529
:repository-name: Ethernet

= {repository-name} Library for Arduino =

image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-arduino.yml/badge.svg["Check Arduino status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-arduino.yml"]
image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/compile-examples.yml/badge.svg["Compile Examples status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/compile-examples.yml"]
image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/spell-check.yml/badge.svg["Spell Check status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/spell-check.yml"]

With the Arduino Ethernet Shield, this library allows an Arduino board to connect to the internet.

For more information about this library please visit us at
https://www.arduino.cc/en/Reference/{repository-name}

== Changes in this fork ==

Drop-in replacement for arduino-libraries/Ethernet 2.0.2, used by SmartLib.

* *No more hangs when the peer disappears.* Upstream spins forever in
  `socketSend()`, `socketSendUDP()` and `EthernetClient::flush()` if the cable
  is pulled or the peer moves networks: the socket stays ESTABLISHED, the chip
  never transmits, so it never times out either. Those waits now give up after
  250 ms (a timed-out send returns 0, which callers already treat as failure),
  and the two "read until stable" register loops give up after 16 reads.
* `Ethernet.setHostname("KitchenLight")` before `begin()` sends a real DHCP
  hostname (option 12) instead of `WIZnetXXXXXX`, so the router's lease list
  says what the device is.
* DHCP asks for NTP servers (option 42); `Ethernet.ntpServerIP()` returns the
  first one, or 0.0.0.0 if the lease has none.

== License ==

Copyright (c) 2010 Arduino LLC. All right reserved.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA