AsyncUDP_Ethernet library
How To Install Using Arduino Library Manager
Features
This AsyncUDP_Ethernet library is a fully asynchronous UDP library, designed for a trouble-free, multi-connection network environment, for ESP8266 boards using W5x00 or ENC28J60 Ethernet using lwIP_w5100, lwIP_w5500 or lwIP_enc28j60 library.
The library is easy to use and includes support for Unicast, Broadcast and Multicast environments.
This library is based on, modified from:
to apply the better and faster asynchronous feature of the powerful ESPAsyncUDP Library into ESP8266 boards using W5x00 or ENC28J60 Ethernet
Why Async is better
- Using asynchronous network means that you can handle more than one connection at the same time
- You are called once the request is ready and parsed
- When you send the response, you are immediately ready to handle other connections while the server is taking care of sending the response in the background
- Speed is OMG
- After connecting to a UDP server as an Async Client, you are immediately ready to handle other connections while the Client is taking care of receiving the UDP responding packets in the background.
- You are not required to check in a tight loop() the arrival of the UDP responding packets to process them.
Currently supported Boards
- ESP8266 boards using W5x00 or ENC28J60 Ethernet with lwIP_w5100, lwIP_w5500 or lwIP_enc28j60 library.
Changelog
Releases v1.2.1
- Initial porting and coding for ESP8266 using W5x00 or ENC28J60 Ethernet
- Bump up version to v1.2.1 to sync with AsyncUDP_STM32 v1.2.1
Debug Termimal Output Samples
1. AsyncUdpNTPClient on ESP8266_NODEMCU_ESP12E with ESP8266_W5500 Ethernet
This is terminal debug output when running AsyncUdpNTPClient on ESP8266_NODEMCU_ESP12E with ESP8266_W5500 Ethernet. It connects to NTP Server "0.ca.pool.ntp.org" (IPAddress(208, 81, 1, 244)) using AsyncUDP_Ethernet library, and requests NTP time every 60s. The packet is then received and processed asynchronously to print current UTC/GMT time.
Start AsyncUdpNTPClient on ESP8266_NODEMCU_ESP12E with ESP8266_W5500 Ethernet
AsyncUDP_Ethernet v1.2.1
Connecting to network : ..
Ethernet DHCP IP address: 192.168.2.188
UDP connected
============= createNTPpacket =============
Received UDP Packet Type: Unicast
From: 208.81.1.244:123, To: 192.168.2.188:56234, Length: 48
Seconds since Jan 1 1900 = 3858990229
Epoch/Unix time = 1650001429
The UTC/GMT time is Fri 2022-04-15 05:43:49 GMT
============= createNTPpacket =============
Received UDP Packet Type: Unicast
From: 208.81.1.244:123, To: 192.168.2.188:56234, Length: 48
Seconds since Jan 1 1900 = 3858990289
Epoch/Unix time = 1650001489
The UTC/GMT time is Fri 2022-04-15 05:44:49 GMT
2. AsyncUdpNTPClient on ESP8266_NODEMCU_ESP12E with ESP8266_ENC28J60 Ethernet
This is terminal debug output when running AsyncUdpNTPClient on ESP8266_NODEMCU_ESP12E with ESP8266_ENC28J60 Ethernet. It connects to NTP Server "0.ca.pool.ntp.org" (IPAddress(208, 81, 1, 244)) using AsyncUDP_Ethernet library, and requests NTP time every 60s. The packet is then received and processed asynchronously to print current UTC/GMT time.
Start AsyncUdpNTPClient on ESP8266_NODEMCU_ESP12E with ESP8266_W5500 Ethernet
AsyncUDP_Ethernet v1.2.1
Connecting to network : ..
Ethernet DHCP IP address: 192.168.2.188
UDP connected
============= createNTPpacket =============
Received UDP Packet Type: Unicast
From: 208.81.1.244:123, To: 192.168.2.188:56234, Length: 48
Seconds since Jan 1 1900 = 3858990229
Epoch/Unix time = 1650001429
The UTC/GMT time is Fri 2022-04-15 05:43:49 GMT
============= createNTPpacket =============
Received UDP Packet Type: Unicast
From: 208.81.1.244:123, To: 192.168.2.188:56234, Length: 48
Seconds since Jan 1 1900 = 3858990289
Epoch/Unix time = 1650001489
The UTC/GMT time is Fri 2022-04-15 05:44:49 GMT