Arduino

Reference Language | Libraries | Comparison | Changes

## Ethernet library

With the Arduino Ethernet Shield, this library allows an Arduino board to connect to the internet. It can serve as either a server accepting incoming connections or a client making outgoing ones. The library supports up to four concurrent connection (incoming or outgoing or a combination).

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.

#### Examples

- ChatServer: set up a simple chat server.
- WebClient: make a HTTP request.
- WebClientRepeating: Make repeated HTTP requests.
- WebServer: host a simple HTML page that displays analog sensor values.
- BarometricPressureWebServer: outputs the values from a barometric pressure sensor as a web page.
- UDPSendReceiveString: Send and receive text strings via UDP.
- UdpNtpClient: Query a Network Time Protocol (NTP) server using UDP.
- DnsWebClient: DNS and DHCP-based Web client.
- DhcpChatServer: A simple DHCP Chat Server
- DhcpAddressPrinter: Get an IP address via DHCP and print it out
- TelnetClient: A simple Telnet client

#### Ethernet class

The Ethernet class initializes the ethernet library and network settings.

- begin()
- localIP()
- maintain()

#### IPAddress class

The IPAddress class works with local and remote IP addressing.

- IPAddress()

#### Server class

The Server class creates servers which can send data to and receive data from connected clients (programs running on other computers or devices).

- Server
- EthernetServer()
- begin()
- available()
- write()
- print()
- println()

#### Client class

The client class creates clients that can connect to servers and send and receive data.

- Client
- EthernetClient()
- if (EthernetClient)
- connected()
- connect()
- write()
- print()
- println()
- available()
- read()
- flush()
- stop()

#### EthernetUDP class

The EthernetUDP class enables UDP message to be sent and received.

- begin()
- read()
- write()
- beginPacket()
- endPacket()
- parsePacket()
- available()
- stop()
- remoteIP()
- remotePort()

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

### Share

### This link has expired.
Please re-subscribe to our Newsletters.

### Subscribe to our Newsletters

Email

Please enter a valid email to subscribe

Arduino Newsletter
Arduino Store Newsletter

### Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy

###### Newsletter

- ©2015 Arduino
- Copyright Notice
- Contact us
- Careers