1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Fixes to UDP so that it no longer has socket 0 hardcoded - all part of issue #436. UdpClass::begin now finds the first available free socket, or fails if they're all in use. UdpClass::stop added to release the socket once it is no longer needed. The global Udp object has also been removed and the examples updated to provide their own instance. Finally, in testing I noticed that the UdpNtpClient didn't print leading 0s if the minute or second was a single-digit, so have taken the opportunity to provide a simple fix for it.

This commit is contained in:
amcewen
2010-12-28 15:16:42 +00:00
parent 53f3e8ef92
commit bc0f3c4fe1
4 changed files with 43 additions and 7 deletions

View File

@ -35,6 +35,8 @@ unsigned int remotePort; // holds received packet's originating port
char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; //buffer to hold incoming packet,
char ReplyBuffer[] = "acknowledged"; // a string to send back
// A UDP instance to let us send and receive packets over UDP
UdpClass Udp;
void setup() {
// start the Ethernet and UDP: