AsyncUDP_Teensy41 library
How To Install Using Arduino Library Manager
Why do we need this AsyncUDP_Teensy41 library
Features
This AsyncUDP_Teensy41 library is a fully asynchronous UDP library, designed for a trouble-free, multi-connection network environment, for Teensy 4.1 using QNEthernet 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 Teensy 4.1 using QNEthernet Library.
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
- Teensy 4.1 using QNEthernet Library
Releases v1.2.1
- Initial porting and coding for Teensy 4.1 using built-in QNEthernet
- Bump up version to v1.2.1 to sync with AsyncUDP_STM32 v1.2.1
Debug Terminal Output Samples
1. AsyncUdpNTPClient on TEENSY 4.1
This is terminal debug output when running AsyncUdpNTPClient on Teensy 4.1 using built-in QNEthernet. It connects to NTP Server "0.ca.pool.ntp.org" @ IPAddress(208, 81, 1, 244)
using AsyncUDP_Teensy41 library, and requests NTP time every 60s. The packet is then received and processed asynchronously to print current UTC/GMT time.
Start AsyncUdpNTPClient on TEENSY 4.1
AsyncUDP_Teensy41 v1.2.1
Initialize Ethernet using DHCP => Connected! IP address:192.168.2.107
UDP connected
============= createNTPpacket =============
[UDP] _recv: Call packetHandler with packet from remoteIP = 208.81.1.244 , remotePort = 123
[UDP] To destIP = 192.168.2.107 , destPort = 62927
[UDP] Packet len = 48
Received UDP Packet Type: Unicast
From: 208.81.1.244:123, To: 192.168.2.107:62927, Length: 48
Seconds since Jan 1 1900 = 3856651358
Epoch/Unix time = 1647662558
The UTC/GMT time is Sat 2022-03-19 04:02:38 GMT
============= createNTPpacket =============
[UDP] _recv: Call packetHandler with packet from remoteIP = 208.81.1.244 , remotePort = 123
[UDP] To destIP = 192.168.2.107 , destPort = 62927
[UDP] Packet len = 48
Received UDP Packet Type: Unicast
From: 208.81.1.244:123, To: 192.168.2.107:62927, Length: 48
Seconds since Jan 1 1900 = 3856651418
Epoch/Unix time = 1647662618
The UTC/GMT time is Sat 2022-03-19 04:03:38 GMT
============= createNTPpacket =============
[UDP] _recv: Call packetHandler with packet from remoteIP = 208.81.1.244 , remotePort = 123
[UDP] To destIP = 192.168.2.107 , destPort = 62927
[UDP] Packet len = 48
Received UDP Packet Type: Unicast
From: 208.81.1.244:123, To: 192.168.2.107:62927, Length: 48
Seconds since Jan 1 1900 = 3856651478
Epoch/Unix time = 1647662678
The UTC/GMT time is Sat 2022-03-19 04:04:38 GMT