Ethernet Shield Sending and Receiving String via UDP
Send and receive text strings via UDP.
Tutorials > Examples > Ethernet > UDPSendReceiveString
In this example, you will use your Ethernet Shield and your Arduino to send and receive text strings via the UDP protocol (Universal Datagram Packet). You'll need another device to send to and from. The Processing sketch included at the end of the code will send to and receive from your Arduino running this example.
Hardware Required
Arduino Board
Circuit
The Ethernet shield allows you to connect a WIZNet Ethernet controller to the Arduino boards via the SPI bus. It uses the ICSP header pins and pin 10 as chip select for the SPI connection to the Ethernet controller chip. Later models of the Ethernet shield also have an SD Card on board. Digital pin 4 is used to control the chip select pin on the SD card.
The shield should be connected to a network with an Ethernet cable. You will need to change the network settings in the program to correspond to your network.
Image developed using Fritzing. For more circuit examples, see the Fritzing project page
In the above image, the Arduino board would be stacked below the Ethernet shield.
Schematic
Code
Processing Code
Copy the Processing sketch from the code sample above. When you type any letter in the Processing sketch window, it will send a string to the Arduino via UDP.
Last revision 2018/09/07 by SM
Suggest changes
The content on docs.arduino.cc is facilitated through a public GitHub repository. If you see anything wrong, you can edit this page here.
License
The Arduino documentation is licensed under the Creative Commons Attribution-Share Alike 4.0 license.