Skip to content

Commit f85a728

Browse files
Fede85cmaglie
authored andcommitted
Ethernet: UdpNtpClient.ino now uses DNS to connect to the NTP server
1 parent 9a64c1b commit f85a728

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libraries/Ethernet/examples/UdpNtpClient/UdpNtpClient.ino

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ byte mac[] = {
2626
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
2727
};
2828

29-
unsigned int localPort = 8888; // local port to listen for UDP packets
29+
unsigned int localPort = 8888; // local port to listen for UDP packets
3030

31-
IPAddress timeServer(192, 43, 244, 18); // time.nist.gov NTP server
31+
char timeServer[] = "time.nist.gov"; // time.nist.gov NTP server
3232

3333
const int NTP_PACKET_SIZE = 48; // NTP time stamp is in the first 48 bytes of the message
3434

@@ -108,7 +108,7 @@ void loop()
108108
}
109109

110110
// send an NTP request to the time server at the given address
111-
unsigned long sendNTPpacket(IPAddress& address)
111+
unsigned long sendNTPpacket(char* address)
112112
{
113113
// set all bytes in the buffer to 0
114114
memset(packetBuffer, 0, NTP_PACKET_SIZE);

0 commit comments

Comments
 (0)