# Changes to existing pages
I have also included improvement suggestions not re…lated to the 2.0.0 release for the affected reference pages because it seems like it will be easier for the person updating the page to make all necessary changes to a page at the same time, rather than addressing multiple issue reports.
---
https://www.arduino.cc/en/Reference/Libraries
Change:
>- Ethernet / Ethernet 2 - for connecting to the internet using the Arduino Ethernet Shield, Arduino Ethernet Shield 2 and Arduino Leonardo ETH
To:
>- **Ethernet** - for connecting to the internet using the Arduino Ethernet Shield, Arduino Ethernet Shield 2 and Arduino Leonardo ETH
---
https://www.arduino.cc/en/Reference/Ethernet
Change:
>Ethernet / Ethernet 2 library
>
>These libraries are designed to work with the Arduino Ethernet Shield (Ethernet.h) or the Arduino Ethernet Shield 2 and Leonardo Ethernet (Ethernet2.h). The libraries are allow an Arduino board to connect to the internet. The board can serve as either a server accepting incoming connections or a client making outgoing ones. The libraries support up to four concurrent connection (incoming or outgoing or a combination). Ethernet library (Ethernet.h) manages the W5100 chip, while Ethernet2 library (Ethernet2.h) manages the W5500 chip; all the functions remain the same. Changing the library used allows to port the same code from Arduino Ethernet Shield to Arduino Ethernet 2 Shield or Arduino Leonardo Ethernet and vice versa.
>
>Arduino communicates with the shield using the SPI bus. This is on digital pins 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used as SS. On the Mega, the hardware SS pin, 53, is not used to select the W5100, but it must be kept as an output or the SPI interface won't work.
To:
>Ethernet library
>
>This library is designed to work with the Arduino Ethernet Shield, Arduino Ethernet Shield 2, Leonardo Ethernet, and any other W5100/W5200/W5500-based devices. The library allows an Arduino board to connect to the Internet. The board can serve as either a server accepting incoming connections or a client making outgoing ones. The library supports up to eight (W5100 and boards with <= 2 kB SRAM are limited to four) concurrent connections (incoming, outgoing, or a combination).
>
>The Arduino board communicates with the shield using the SPI bus. This is on digital pins 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used as SS. On the Mega, the hardware SS pin, 53, is not used to select the Ethernet controller chip, but it must be kept as an output or the SPI interface won't work.
---
https://www.arduino.cc/en/Tutorial/WebClient
Change:
>The results of this search are viewable as HTML through your Arduino's serial window.
To:
>The results of this search are viewable as HTML **in the Serial Monitor**.
---
Change:
>The Ethernet shield allows you to connect a WizNet Ethernet controller to the Arduino or Genuino boards via the SPI bus.
To:
>The Ethernet shield allows you to connect a **WIZnet** Ethernet controller to the Arduino or Genuino boards via the SPI bus.
---
Change:
>It uses pins 10, 11, 12, and 13 for the SPI connection to the WizNet.
To:
>It uses **the ICSP header pins and pin 10 as chip select** for the SPI connection to the **Ethernet controller chip**.
---
Change:
>The shield should be connected to a network with an ethernet cable.
To:
>The shield should be connected to a network with an **Ethernet** cable.
---
Change:
>image developed using Fritzing.
To:
>**Image** developed using Fritzing.
---
Remove:
>Please note: according to your hardware setup, you need to comment / uncomment the libraries at the beginning of the sketch. Use Ethernet.h with the Arduino Ethernet Shield or Ethernet2.h with the Arduino Ethernet Shield 2 and Leonardo Ethernet.
---
https://www.arduino.cc/en/Tutorial/WebClientRepeating
Change:
>The conent of the page is viewable through your Arduino's serial window.
To:
>The **content** of the page is viewable **in the Serial Monitor**.
---
Change:
>The Ethernet shield allows you to connect a WizNet Ethernet controller to the Arduino or Genuino boards via the SPI bus.
To:
>The Ethernet shield allows you to connect a **WIZnet** Ethernet controller to the Arduino or Genuino boards via the SPI bus.
---
Change:
>It uses pins 10, 11, 12, and 13 for the SPI connection to the WizNet.
To:
>It uses **the ICSP header pins and pin 10 as chip select** for the SPI connection to the **Ethernet controller chip**.
---
Change:
>The shield should be connected to a network with an ethernet cable.
To:
>The shield should be connected to a network with an **Ethernet** cable.
---
Change:
>image developed using Fritzing.
To:
>**Image** developed using Fritzing.
---
Remove:
>Please note: according to your hardware setup, you need to comment / uncomment the libraries at the beginning of the sketch. Use Ethernet.h with the Arduino Ethernet Shield or Ethernet2.h with the Arduino Ethernet Shield 2 and Leonardo Ethernet.
---
https://www.arduino.cc/en/Tutorial/WebServer
Change:
>The Ethernet shield allows you to connect a WizNet Ethernet controller to the Arduino or Genuino boards via the SPI bus.
To:
>The Ethernet shield allows you to connect a **WIZnet** Ethernet controller to the Arduino or Genuino boards via the SPI bus.
---
Change:
>It uses pins 10, 11, 12, and 13 for the SPI connection to the WizNet.
To:
>It uses **the ICSP header pins and pin 10 as chip select** for the SPI connection to the **Ethernet controller chip**.
---
Change:
>The shield should be connected to a network with an ethernet cable.
To:
>The shield should be connected to a network with an **Ethernet** cable.
---
Change:
>image developed using Fritzing.
To:
>**Image** developed using Fritzing.
---
Remove:
>Please note: according to your hardware setup, you need to comment / uncomment the libraries at the beginning of the sketch. Use Ethernet.h with the Arduino Ethernet Shield or Ethernet2.h with the Arduino Ethernet Shield 2 and Leonardo Ethernet.
---
https://www.arduino.cc/en/Tutorial/BarometricPressureWebServer
Change:
>Your Barometric Pressure sensor will be attached to pins 6,7, and 11 - 13
To:
>Your Barometric Pressure sensor will be attached to pins **6, 7**, and the SPI pins
---
Change:
>Your sensor's MOSI (Master Out Slave In) pin should then be connected to digital pin 11, and it's counterpart MISO (Master In Slave Out) to digital pin 12. Finally, connect the SCK pin, the SPI clock input on your sensor, to digital pin 13 on your device, and make sure that the two share a common ground.
To:
>Your sensor's MOSI (Master Out Slave In), MISO (Master In Slave Out), and SCK (SPI clock input) pins should then be connected to the SPI pins on your Arduino board/shield. The SPI pin numbers differ depending on which Arduino board you're using and are listed in the [SPI reference page](https://www.arduino.cc/en/Reference/SPI). Make sure that the two share a common ground.
---
Change:
>The shield should be connected to a network with an ethernet cable.
To:
>The shield should be connected to a network with an **Ethernet** cable.
---
Change:
>image developed using Fritzing.
To:
>**Image** developed using Fritzing.
---
Remove:
>Please note: according to your hardware setup, you need to comment / uncomment the libraries at the beginning of the sketch. Use Ethernet.h with the Arduino Ethernet Shield or Ethernet2.h with the Arduino Ethernet Shield 2 and Leonardo Ethernet.
---
https://www.arduino.cc/en/Tutorial/UDPSendReceiveString
Change:
>The Ethernet shield allows you to connect a WizNet Ethernet controller to the Arduino or Genuino boards via the SPI bus.
To:
>The Ethernet shield allows you to connect a **WIZnet** Ethernet controller to the Arduino or Genuino boards via the SPI bus.
---
Change:
>It uses pins 10, 11, 12, and 13 for the SPI connection to the WizNet.
To:
>It uses **the ICSP header pins and pin 10 as chip select** for the SPI connection to the **Ethernet controller chip**.
---
Change:
>The shield should be connected to a network with an ethernet cable.
To:
>The shield should be connected to a network with an **Ethernet** cable.
---
Change:
>image developed using Fritzing.
To:
>**Image** developed using Fritzing.
---
Remove:
>Please note: according to your hardware setup, you need to comment / uncomment the libraries at the beginning of the sketch. Use Ethernet.h with the Arduino Ethernet Shield or Ethernet2.h with the Arduino Ethernet Shield 2 and Leonardo Ethernet.
---
https://www.arduino.cc/en/Tutorial/UdpNtpClient
Change:
>The Ethernet shield allows you to connect a WizNet Ethernet controller to the Arduino or Genuino boards via the SPI bus.
To:
>The Ethernet shield allows you to connect a **WIZnet** Ethernet controller to the Arduino or Genuino boards via the SPI bus.
---
Change:
>It uses pins 10, 11, 12, and 13 for the SPI connection to the WizNet.
To:
>It uses **the ICSP header pins and pin 10 as chip select** for the SPI connection to the **Ethernet controller chip**.
---
Change:
>The shield should be connected to a network with an ethernet cable.
To:
>The shield should be connected to a network with an **Ethernet** cable.
---
Change:
>image developed using Fritzing.
To:
>**Image** developed using Fritzing.
---
Remove:
>Please note: according to your hardware setup, you need to comment / uncomment the libraries at the beginning of the sketch. Use Ethernet.h with the Arduino Ethernet Shield or Ethernet2.h with the Arduino Ethernet Shield 2 and Leonardo Ethernet.
---
https://www.arduino.cc/en/Tutorial/DhcpChatServer
Change:
>The Serial monitor works well for this purpose.
To:
>The Serial **Monitor** works well for this purpose.
---
Change:
>The Ethernet shield allows you to connect a WizNet Ethernet controller to the Arduino or Genuino boards via the SPI bus.
To:
>The Ethernet shield allows you to connect a **WIZnet** Ethernet controller to the Arduino or Genuino boards via the SPI bus.
---
Change:
>It uses pins 10, 11, 12, and 13 for the SPI connection to the WizNet.
To:
>It uses **the ICSP header pins and pin 10 as chip select** for the SPI connection to the **Ethernet controller chip**.
---
Change:
>The shield should be connected to a network with an ethernet cable.
To:
>The shield should be connected to a network with an **Ethernet** cable.
---
Change:
>image developed using Fritzing.
To:
>**Image** developed using Fritzing.
---
Remove:
>Please note: according to your hardware setup, you need to comment / uncomment the libraries at the beginning of the sketch. Use Ethernet.h with the Arduino Ethernet Shield or Ethernet2.h with the Arduino Ethernet Shield 2 and Leonardo Ethernet.
---
https://www.arduino.cc/en/Tutorial/DhcpAddressPrinter
Change:
> Using the localIP() function, the assigned IP address is sent out via the serial monitor.
To:
> Using the localIP() function, the assigned IP address is sent out via the **Serial Monitor**.
---
Change:
>The Ethernet shield allows you to connect a WizNet Ethernet controller to the Arduino or Genuino boards via the SPI bus.
To:
>The Ethernet shield allows you to connect a **WIZnet** Ethernet controller to the Arduino or Genuino boards via the SPI bus.
---
Change:
>It uses pins 10, 11, 12, and 13 for the SPI connection to the WizNet.
To:
>It uses **the ICSP header pins and pin 10 as chip select** for the SPI connection to the **Ethernet controller chip**.
---
Change:
>The shield should be connected to a network with an ethernet cable.
To:
>The shield should be connected to a network with an **Ethernet** cable.
---
Change:
>image developed using Fritzing.
To:
>**Image** developed using Fritzing.
---
Remove:
>Please note: according to your hardware setup, you need to comment / uncomment the libraries at the beginning of the sketch. Use Ethernet.h with the Arduino Ethernet Shield or Ethernet2.h with the Arduino Ethernet Shield 2 and Leonardo Ethernet.
---
https://www.arduino.cc/en/Tutorial/TelnetClient
Change:
>The Ethernet shield allows you to connect a WizNet Ethernet controller to the Arduino or Genuino boards via the SPI bus.
To:
>The Ethernet shield allows you to connect a **WIZnet** Ethernet controller to the Arduino or Genuino boards via the SPI bus.
---
Change:
>It uses pins 10, 11, 12, and 13 for the SPI connection to the WizNet.
To:
>It uses **the ICSP header pins and pin 10 as chip select** for the SPI connection to the **Ethernet controller chip**.
---
Change:
>The shield should be connected to a network with an ethernet cable.
To:
>The shield should be connected to a network with an **Ethernet** cable.
---
Change:
>image developed using Fritzing.
To:
>**Image** developed using Fritzing.
---
Remove:
>Please note: according to your hardware setup, you need to comment / uncomment the libraries at the beginning of the sketch. Use Ethernet.h with the Arduino Ethernet Shield or Ethernet2.h with the Arduino Ethernet Shield 2 and Leonardo Ethernet.
---
Change:
>The Serial monitor works well for this purpose.
To:
>The Serial **Monitor** works well for this purpose.
---
Change:
>The Ethernet shield allows you to connect a WizNet Ethernet controller to the Arduino or Genuino boards via the SPI bus.
To:
>The Ethernet shield allows you to connect a **WIZnet** Ethernet controller to the Arduino or Genuino boards via the SPI bus.
---
Change:
>It uses pins 10, 11, 12, and 13 for the SPI connection to the WizNet.
To:
>It uses **the ICSP header pins and pin 10 as chip select** for the SPI connection to the **Ethernet controller chip**.
---
Change:
>The shield should be connected to a network with an ethernet cable.
To:
>The shield should be connected to a network with an **Ethernet** cable.
---
Change:
>image developed using Fritzing.
To:
>**Image** developed using Fritzing.
---
Remove:
>Please note: according to your hardware setup, you need to comment / uncomment the libraries at the beginning of the sketch. Use Ethernet.h with the Arduino Ethernet Shield or Ethernet2.h with the Arduino Ethernet Shield 2 and Leonardo Ethernet.
---
https://www.arduino.cc/en/Guide/ArduinoEthernetShield
Change:
>The Arduino Ethernet shield 2
To:
>The Arduino Ethernet **Shield** 2
---
Remove:
>Depending on the shield version you have, you need to use the proper library, as documented in the Ethernet library page.
---
Change:
>Here a list of tutorials that will help you in making very cool things!
To:
>**Here is** a list of tutorials that will help you in making very cool things!
---
https://store.arduino.cc/arduino-ethernet-shield-2
Change:
>Learn more on the Ethernet Shield 2 in the Ethernet2 Library reference
To:
>Learn more on the Ethernet Shield 2 in the **Ethernet** Library reference
---
https://www.arduino.cc/en/Reference/EthernetBegin
Change:
>Initializes the ethernet library and network settings.
To:
>Initializes the **Ethernet** library and network settings.
---
Change:
>With version 1.0, the library supports DHCP.
To:
>Version 1.0 and newer of the Ethernet library supports DHCP.
---
Change:
>Using Ethernet.begin(mac) with the proper network setup
To:
>Using **`Ethernet.begin(mac)`** with the proper network setup
---
Change:
>For older shields, choose your own.
To:
>For older shields, choose any MAC you like so long as it's unique on your network.
---
Change:
>ip: the IP address of the device (array of 4 bytes)
To:
>ip: the IP address of the device (**IPAddress**)
---
Change:
>the IP address of the DNS server (array of 4 bytes).
To:
>the IP address of the DNS server (**IPAddress**).
---
Change:
>the IP address of the network gateway (array of 4 bytes).
To:
>the IP address of the network gateway (**IPAddress**).
---
Change:
>the subnet mask of the network (array of 4 bytes).
To:
>the subnet mask of the network (**IPAddress**)
---
Change:
>The DHCP version of this function, Ethernet.begin(mac), returns an int
To:
>The DHCP version of this function, **`Ethernet.begin(mac)`**, returns an int
---
Add:
>#### See also
- [Ethernet.init()](https://www.arduino.cc/en/Reference/EthernetInit)
---
https://www.arduino.cc/en/Reference/EthernetLocalIP
Change:
>Returns
>
>the IP address
To:
>Returns
>
>the IP address **(IPAddress)**
---
Add:
>#### See also
- [Ethernet.MACAddress()](https://www.arduino.cc/en/Reference/EthernetMACAddress)
- [Ethernet.dnsServerIP()](https://www.arduino.cc/en/Reference/EthernetSetDnsServerIP)
- [Ethernet.gatewayIP()](https://www.arduino.cc/en/Reference/EthernetGatewayIP)
- [Ethernet.subnetMask()](https://www.arduino.cc/en/Reference/EthernetSubnetMask)
---
https://www.arduino.cc/en/Reference/ServerAvailable
Change:
>you can close it by calling client.stop().
To:
>you can close it by calling **`client.stop()`**.
---
Change:
>See Also
>
>- Stream.available()
To:
>See Also
>
>- **[*server*.accept()](https://www.arduino.cc/en/Reference/EthernetServerAccept)**
---
## New reference pages to create
Based partly on information from Paul Stoffregen's blog post: https://www.pjrc.com/arduino-ethernet-library-2-0-0/
---
https://www.arduino.cc/en/Reference/EthernetInit
### Ethernet.init()
#### Description
Used to configure the CS (chip select) pin for the Ethernet controller chip. The Ethernet library has a default CS pin, which is usually correct, but with some non-standard Ethernet hardware you might need to use a different CS pin.
#### Syntax
Ethernet.init(sspin)
#### Parameters
sspin: the pin number to use for CS (byte)
#### Returns
Nothing
#### Example
```cpp
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
void setup() {
Ethernet.init(53); // use pin 53 for Ethernet CS
Ethernet.begin(mac, ip);
}
void loop () {}
```
---
https://www.arduino.cc/en/Reference/ClientRemoteIP
### remoteIP()
#### Description
Returns the IP address of the client.
#### Syntax
*client*.remoteIP()
#### Parameters
none
#### Returns
the client's IP address (IPAddress)
#### Example
```cpp
#include <Ethernet.h>
#include <SPI.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
// telnet defaults to port 23
EthernetServer server = EthernetServer(23);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// initialize the Ethernet device
Ethernet.begin(mac, ip);
// start listening for clients
server.begin();
}
void loop() {
// if an incoming client connects, there will be bytes available to read:
EthernetClient client = server.available();
if (client) {
Serial.print("Remote IP address: ");
Serial.println(client.remoteIP());
client.stop();
}
}
```
#### See also
- [*client*.localPort()](https://www.arduino.cc/en/Reference/ClientLocalPort)
- [*client*.remotePort()](https://www.arduino.cc/en/Reference/ClientRemotePort)
---
https://www.arduino.cc/en/Reference/ClientLocalPort
### localPort()
#### Description
Returns the local port number the client is connected to.
#### Syntax
*client*.localPort()
#### Parameters
none
#### Returns
the local port number the client is connected to (uint16_t)
#### Example
```cpp
#include <Ethernet.h>
#include <SPI.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
// telnet defaults to port 23
EthernetServer server = EthernetServer(23);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// initialize the Ethernet device
Ethernet.begin(mac, ip);
// start listening for clients
server.begin();
}
void loop() {
// if an incoming client connects, there will be bytes available to read:
EthernetClient client = server.available();
if (client) {
Serial.print("Client is connected on port: ");
Serial.println(client.localPort());
client.stop();
}
}
```
#### See also
- [*client*.remotePort()](https://www.arduino.cc/en/Reference/ClientRemotePort)
- [*client*.remoteIP()](https://www.arduino.cc/en/Reference/ClientRemoteIP)
---
https://www.arduino.cc/en/Reference/ClientRemotePort
### remotePort()
#### Description
Returns the port of the host that sent the current incoming packet.
#### Syntax
*client*.remotePort()
#### Parameters
none
#### Returns
the port of the host that sent the current incoming packet (uint16_t)
#### Example
```cpp
#include <Ethernet.h>
#include <SPI.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
// telnet defaults to port 23
EthernetServer server = EthernetServer(23);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// initialize the Ethernet device
Ethernet.begin(mac, ip);
// start listening for clients
server.begin();
}
void loop() {
// if an incoming client connects, there will be bytes available to read:
EthernetClient client = server.available();
if (client) {
Serial.print("Remote port: ");
Serial.println(client.remotePort());
client.stop();
}
}
```
#### See also
- [*client*.localPort()](https://www.arduino.cc/en/Reference/ClientLocalPort)
- [*client*.remoteIP()](https://www.arduino.cc/en/Reference/ClientRemoteIP)
---
https://www.arduino.cc/en/Reference/EthernetSetRetransmissionTimeout
### Ethernet.setRetransmissionTimeout()
#### Description
Set the Ethernet controller's timeout. The initial value is 200 ms. A 200 ms timeout times the default of 8 attempts equals a blocking delay of 1600 ms during a communications failure. You might prefer to set a shorter timeout to make your program more responsive in the event something goes wrong with communications. You will need to do some experimentation to determine an appropriate value for your specific application.
#### Syntax
Ethernet.setRetransmissionTimeout(milliseconds)
#### Parameters
milliseconds: the timeout duration (uint16_t)
#### Returns
Nothing
#### Example
```cpp
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
void setup() {
Ethernet.begin(mac, ip);
Ethernet.setRetransmissionTimeout(50); // set the Ethernet controller's timeout to 50 ms
}
void loop () {}
```
#### See also
- [Ethernet.setRetransmissionCount()](https://www.arduino.cc/en/Reference/EthernetSetRetransmissionCount)
- [*client*.setConnectionTimeout()](https://www.arduino.cc/en/Reference/EthernetClientSetConnectionTimeout)
- [Stream.setTimeout()](https://www.arduino.cc/reference/en/language/functions/communication/stream/streamsettimeout/)
---
https://www.arduino.cc/en/Reference/EthernetSetRetransmissionCount
### Ethernet.setRetransmissionCount()
#### Description
Set the number of transmission attempts the Ethernet controller will make before giving up. The initial value is 8. 8 transmission attempts times the 200 ms default timeout equals a blocking delay of 1600 ms during a communications failure. You might prefer to set a lower number to make your program more responsive in the event something goes wrong with communications. Despite the name, this sets the **total** number of transmission attempts (not the number of retries after the first attempt fails) so the minimum value you would ever want to set is 1.
#### Syntax
Ethernet.setRetransmissionCount(number)
#### Parameters
number: number of transmission attempts the Ethernet controller should make before giving up (byte)
#### Returns
Nothing
#### Example
```cpp
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
void setup() {
Ethernet.begin(mac, ip);
Ethernet.setRetransmissionCount(1); // configure the Ethernet controller to only attempt one transmission before giving up
}
void loop () {}
```
#### See also
- [Ethernet.setRetransmissionTimeout()](https://www.arduino.cc/en/Reference/EthernetSetRetransmissionTimeout)
- [*client*.setConnectionTimeout()](https://www.arduino.cc/en/Reference/EthernetClientSetConnectionTimeout)
- [Stream.setTimeout()](https://www.arduino.cc/reference/en/language/functions/communication/stream/streamsettimeout/)
---
https://www.arduino.cc/en/Reference/EthernetClientSetConnectionTimeout
### setConnectionTimeout()
#### Description
Set the timeout for `client.connect()` and `client.stop()`. The initial value is 1000 ms. You might prefer to set a lower timeout value to make your program more responsive in the event something goes wrong.
#### Syntax
*client*.setConnectionTimeout(milliseconds)
#### Parameters
milliseconds: the timeout duration for `client.connect()` and `client.stop()` (uint16_t)
#### Returns
Nothing
#### Example
```cpp
#include <Ethernet.h>
#include <SPI.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
// telnet defaults to port 23
EthernetServer server = EthernetServer(23);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// initialize the Ethernet device
Ethernet.begin(mac, ip);
// start listening for clients
server.begin();
}
void loop() {
// if an incoming client connects, there will be bytes available to read:
EthernetClient client = server.available();
if (client) {
client.setConnectionTimeout(100); // set the timeout duration for client.connect() and client.stop()
}
}
```
#### See also
- [Ethernet.setRetransmissionCount()](https://www.arduino.cc/en/Reference/EthernetSetRetransmissionCount)
- [Ethernet.setRetransmissionTimeout()](https://www.arduino.cc/en/Reference/EthernetSetRetransmissionTimeout)
- [Stream.setTimeout()](https://www.arduino.cc/reference/en/language/functions/communication/stream/streamsettimeout/)
---
https://www.arduino.cc/en/Reference/EthernetServerAccept
### accept()
#### Description
The traditional [*server*.available()](https://www.arduino.cc/en/Reference/ServerAvailable) function would only tell you of a new client after it sent data, which makes some protocols like FTP impossible to properly implement.
The intention is programs will use either `available()` or `accept()`, but not both. With `available()`, the client connection continues to be managed by EthernetServer. You don’t need to keep a client object, since calling `available()` will give you whatever client has sent data. Simple servers can be written with very little code using `available()`.
With `accept()`, EthernetServer gives you the client only once, regardless of whether it has sent any data. You must keep track of the connected clients. This requires more code, but you gain more control.
#### Syntax
*server*.accept()
#### Parameters
none
#### Returns
a Client object. If no client has data available for reading, this object will evaluate to false in an if-statement. (EthernetClient)
#### Example
```cpp
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(192, 168, 69, 104);
// telnet defaults to port 23
EthernetServer server(23);
EthernetClient clients[8];
void setup() {
Ethernet.begin(mac, ip);
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// start listening for clients
server.begin();
}
void loop() {
// check for any new client connecting, and say hello (before any incoming data)
EthernetClient newClient = server.accept();
if (newClient) {
for (byte i = 0; i < 8; i++) {
if (!clients[i]) {
newClient.print("Hello, client number: ");
newClient.println(i);
// Once we "accept", the client is no longer tracked by EthernetServer
// so we must store it into our list of clients
clients[i] = newClient;
break;
}
}
}
// check for incoming data from all clients
for (byte i = 0; i < 8; i++) {
while (clients[i] && clients[i].available() > 0) {
// read incoming data from the client
Serial.write(clients[i].read());
}
}
// stop any clients which disconnect
for (byte i = 0; i < 8; i++) {
if (clients[i] && !clients[i].connected()) {
clients[i].stop();
}
}
}
```
#### See also
- [*server*.available()](https://www.arduino.cc/en/Reference/ServerAvailable)
---
https://www.arduino.cc/en/Reference/IfEthernetServer
#### Description
Indicates whether the server is listening for new clients. You can use this to detect whether `server.begin()` was successful. It can also tell you when no more sockets are available to listen for more clients, because the maximum number have connected.
#### Syntax
if (server)
#### Parameters
none
#### Returns
whether the server is listening for new clients (bool)
#### Example
```cpp
#include <Ethernet.h>
#include <SPI.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
// telnet defaults to port 23
EthernetServer server = EthernetServer(23);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// initialize the Ethernet device
Ethernet.begin(mac, ip);
// start listening for clients
server.begin();
}
void loop() {
if (server) {
Serial.println("Server is listening");
}
else {
Serial.println("Server is not listening");
}
}
```
---
https://www.arduino.cc/en/Reference/EthernetHardwareStatus
### Ethernet.hardwareStatus()
#### Description
`Ethernet.hardwareStatus()` tells you which WIZnet Ethernet controller chip was detected during `Ethernet.begin()`, if any. This can be used for troubleshooting. If no Ethernet controller was detected then there is likely a hardware problem.
#### Syntax
Ethernet.hardwareStatus()
#### Parameters
none
#### Returns
which WIZnet Ethernet controller chip was detected during `Ethernet.begin()` (EthernetHardwareStatus):
- EthernetNoHardware
- EthernetW5100
- EthernetW5200
- EthernetW5500
#### Example
```cpp
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Ethernet.begin(mac, ip);
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
Serial.println("Ethernet shield was not found.");
}
else if (Ethernet.hardwareStatus() == EthernetW5100) {
Serial.println("W5100 Ethernet controller detected.");
}
else if (Ethernet.hardwareStatus() == EthernetW5200) {
Serial.println("W5200 Ethernet controller detected.");
}
else if (Ethernet.hardwareStatus() == EthernetW5500) {
Serial.println("W5500 Ethernet controller detected.");
}
}
void loop () {}
```
#### See also
- [Ethernet.linkStatus()](https://www.arduino.cc/en/Reference/EthernetLinkStatus)
---
https://www.arduino.cc/en/Reference/EthernetLinkStatus
### Ethernet.linkStatus()
#### Description
Tells you whether the link is active. `LinkOFF` could indicate the Ethernet cable is unplugged or defective. This feature is only available when using the W5200 and W5500 Ethernet controller chips.
#### Syntax
Ethernet.linkStatus()
#### Parameters
none
#### Returns
the link status (EthernetLinkStatus):
- Unknown
- LinkON
- LinkOFF
#### Example
```cpp
#include <SPI.h>
#include <Ethernet.h>
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
}
void loop () {
if (Ethernet.linkStatus() == Unknown) {
Serial.println("Link status unknown. Link status detection is only available with W5200 and W5500.");
}
else if (Ethernet.linkStatus() == LinkON) {
Serial.println("Link status: On");
}
else if (Ethernet.linkStatus() == LinkOFF) {
Serial.println("Link status: Off");
}
}
```
#### See also
- [Ethernet.hardwareStatus()](https://www.arduino.cc/en/Reference/EthernetHardwareStatus)
---
https://www.arduino.cc/en/Reference/EthernetSetMACAddress
### Ethernet.setMACAddress()
#### Description
Set the MAC address. Not for use with DHCP.
#### Syntax
Ethernet.setMACAddress(mac)
#### Parameters
mac: the MAC address to use (array of 6 bytes)
#### Returns
Nothing
#### Example
```cpp
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
void setup() {
Ethernet.begin(mac, ip);
byte newMac[] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02};
Ethernet.setMACAddress(newMac); // change the MAC address
}
void loop () {}
```
#### See also
- [Ethernet.setLocalIP()](https://www.arduino.cc/en/Reference/EthernetSetLocalIP)
- [Ethernet.setDnsServerIP()](https://www.arduino.cc/en/Reference/EthernetSetDnsServerIP)
- [Ethernet.setGatewayIP()](https://www.arduino.cc/en/Reference/EthernetSetGatewayIP)
- [Ethernet.setSubnetMask()](https://www.arduino.cc/en/Reference/EthernetSetSubnetMask)
- [Ethernet.begin()](https://www.arduino.cc/en/Reference/EthernetBegin)
---
https://www.arduino.cc/en/Reference/EthernetSetLocalIP
### Ethernet.setLocalIP()
#### Description
Set the IP address of the device. Not for use with DHCP.
#### Syntax
Ethernet.setLocalIP(local_ip)
#### Parameters
local_ip: the IP address to use (IPAddress)
#### Returns
Nothing
#### Example
```cpp
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
void setup() {
Ethernet.begin(mac, ip);
IPAddress newIp(10, 0, 0, 178);
Ethernet.setLocalIP(newIp); // change the IP address
}
void loop () {}
```
#### See also
- [Ethernet.setMACAddress()](https://www.arduino.cc/en/Reference/EthernetSetMACAddress)
- [Ethernet.setDnsServerIP()](https://www.arduino.cc/en/Reference/EthernetSetDnsServerIP)
- [Ethernet.setGatewayIP()](https://www.arduino.cc/en/Reference/EthernetSetGatewayIP)
- [Ethernet.setSubnetMask()](https://www.arduino.cc/en/Reference/EthernetSetSubnetMask)
- [Ethernet.begin()](https://www.arduino.cc/en/Reference/EthernetBegin)
---
https://www.arduino.cc/en/Reference/EthernetSetDnsServerIP
### Ethernet.setDnsServerIP()
#### Description
Set the IP address of the DNS server. Not for use with DHCP.
#### Syntax
Ethernet.setDnsServerIP(dns_server)
#### Parameters
dns_server: the IP address of the DNS server (IPAddress)
#### Returns
Nothing
#### Example
```cpp
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
IPAddress myDns(192, 168, 1, 1);
void setup() {
Ethernet.begin(mac, ip, myDns);
IPAddress newDns(192, 168, 1, 1);
Ethernet.setDnsServerIP(newDns); // change the DNS server IP address
}
void loop () {}
```
#### See also
- [Ethernet.setMACAddress()](https://www.arduino.cc/en/Reference/EthernetSetMACAddress)
- [Ethernet.setLocalIP()](https://www.arduino.cc/en/Reference/EthernetSetLocalIP)
- [Ethernet.setGatewayIP()](https://www.arduino.cc/en/Reference/EthernetSetGatewayIP)
- [Ethernet.setSubnetMask()](https://www.arduino.cc/en/Reference/EthernetSetSubnetMask)
- [Ethernet.begin()](https://www.arduino.cc/en/Reference/EthernetBegin)
---
https://www.arduino.cc/en/Reference/EthernetSetGatewayIP
### Ethernet.setGatewayIP()
#### Description
Set the IP address of the network gateway. Not for use with DHCP.
#### Syntax
Ethernet.setGatewayIP(gateway)
#### Parameters
gateway: the IP address of the network gateway (IPAddress)
#### Returns
Nothing
#### Example
```cpp
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
IPAddress myDns(192, 168, 1, 1);
IPAddress gateway(192, 168, 1, 1);
void setup() {
Ethernet.begin(mac, ip, myDns, gateway);
IPAddress newGateway(192, 168, 100, 1);
Ethernet.setGatewayIP(newGateway); // change the gateway IP address
}
void loop () {}
```
#### See also
- [Ethernet.setMACAddress()](https://www.arduino.cc/en/Reference/EthernetSetMACAddress)
- [Ethernet.setLocalIP()](https://www.arduino.cc/en/Reference/EthernetSetLocalIP)
- [Ethernet.setDnsServerIP()](https://www.arduino.cc/en/Reference/EthernetSetDnsServerIP)
- [Ethernet.setSubnetMask()](https://www.arduino.cc/en/Reference/EthernetSetSubnetMask)
- [Ethernet.begin()](https://www.arduino.cc/en/Reference/EthernetBegin)
---
https://www.arduino.cc/en/Reference/EthernetSetSubnetMask
### Ethernet.setSubnetMask()
#### Description
Set the subnet mask of the network. Not for use with DHCP.
#### Syntax
Ethernet.setSubnetMask(subnet)
#### Parameters
subnet: the subnet mask of the network (IPAddress)
#### Returns
Nothing
#### Example
```cpp
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
IPAddress myDns(192, 168, 1, 1);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 0, 0);
void setup() {
Ethernet.begin(mac, ip, myDns, gateway, subnet);
IPAddress newSubnet(255, 255, 255, 0);
Ethernet.setSubnetMask(newSubnet); // change the subnet mask
}
void loop () {}
```
#### See also
- [Ethernet.setMACAddress()](https://www.arduino.cc/en/Reference/EthernetSetMACAddress)
- [Ethernet.setLocalIP()](https://www.arduino.cc/en/Reference/EthernetSetLocalIP)
- [Ethernet.setDnsServerIP()](https://www.arduino.cc/en/Reference/EthernetSetDnsServerIP)
- [Ethernet.setGatewayIP()](https://www.arduino.cc/en/Reference/EthernetSetGatewayIP)
- [Ethernet.begin()](https://www.arduino.cc/en/Reference/EthernetBegin)
---
https://www.arduino.cc/en/Reference/EthernetMACAddress
### Ethernet.MACAddress()
#### Description
Fills the supplied buffer with the MAC address of the device.
#### Syntax
Ethernet.MACAddress(mac_address)
#### Parameters
mac_address: buffer to receive the MAC address (array of 6 bytes)
#### Returns
Nothing
#### Example
```cpp
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Ethernet.begin(mac, ip);
byte macBuffer[6]; // create a buffer to hold the MAC address
Ethernet.MACAddress(macBuffer); // fill the buffer
Serial.print("The MAC address is: ");
for (byte octet = 0; octet < 6; octet++) {
Serial.print(macBuffer[octet], HEX);
if (octet < 5) {
Serial.print('-');
}
}
}
void loop () {}
```
#### See also
- [Ethernet.localIP()](https://www.arduino.cc/en/Reference/EthernetLocalIP)
- [Ethernet.dnsServerIP()](https://www.arduino.cc/en/Reference/EthernetDnsServerIP)
- [Ethernet.gatewayIP()](https://www.arduino.cc/en/Reference/EthernetGatewayIP)
- [Ethernet.subnetMask()](https://www.arduino.cc/en/Reference/EthernetSubnetMask)
---
https://www.arduino.cc/en/Reference/EthernetDnsServerIP
### Ethernet.dnsServerIP()
#### Description
Returns the DNS server IP address for the device.
#### Syntax
Ethernet.dnsServerIP()
#### Parameters
none
#### Returns
the DNS server IP address for the device (IPAddress)
#### Example
```cpp
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Ethernet.begin(mac, ip);
Serial.print("The DNS server IP address is: ");
Serial.println(Ethernet.dnsServerIP());
}
void loop () {}
```
#### See also
- [Ethernet.MACAddress()](https://www.arduino.cc/en/Reference/EthernetMACAddress)
- [Ethernet.localIP()](https://www.arduino.cc/en/Reference/EthernetLocalIP)
- [Ethernet.gatewayIP()](https://www.arduino.cc/en/Reference/EthernetGatewayIP)
- [Ethernet.subnetMask()](https://www.arduino.cc/en/Reference/EthernetSubnetMask)
---
https://www.arduino.cc/en/Reference/EthernetGatewayIP
### Ethernet.gatewayIP()
#### Description
Returns the gateway IP address for the device.
#### Syntax
Ethernet.gatewayIP()
#### Parameters
none
#### Returns
the gateway IP address for the device (IPAddress)
#### Example
```cpp
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Ethernet.begin(mac, ip);
Serial.print("The gateway IP address is: ");
Serial.println(Ethernet.gatewayIP());
}
void loop () {}
```
#### See also
- [Ethernet.MACAddress()](https://www.arduino.cc/en/Reference/EthernetMACAddress)
- [Ethernet.localIP()](https://www.arduino.cc/en/Reference/EthernetLocalIP)
- [Ethernet.dnsServerIP()](https://www.arduino.cc/en/Reference/EthernetDnsServerIP)
- [Ethernet.subnetMask()](https://www.arduino.cc/en/Reference/EthernetSubnetMask)
---
https://www.arduino.cc/en/Reference/EthernetSubnetMask
### Ethernet.subnetMask()
#### Description
Returns the subnet mask of the device.
#### Syntax
Ethernet.subnetMask()
#### Parameters
none
#### Returns
the subnet mask of the device (IPAddress)
#### Example
```cpp
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
IPAddress ip(10, 0, 0, 177);
void setup() {
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Ethernet.begin(mac, ip);
Serial.print("The subnet mask is: ");
Serial.println(Ethernet.subnetMask());
}
void loop () {}
```
#### See also
- [Ethernet.MACAddress()](https://www.arduino.cc/en/Reference/EthernetMACAddress)
- [Ethernet.localIP()](https://www.arduino.cc/en/Reference/EthernetLocalIP)
- [Ethernet.dnsServerIP()](https://www.arduino.cc/en/Reference/EthernetDnsServerIP)
- [Ethernet.gatewayIP()](https://www.arduino.cc/en/Reference/EthernetGatewayIP)