dns timeout is part of udp
This commit is contained in:
parent
b740822829
commit
d2161a6717
@ -92,7 +92,7 @@ bool NTPClient::forceUpdate(uint16_t timeout) {
|
|||||||
while(this->_udp->parsePacket() != 0)
|
while(this->_udp->parsePacket() != 0)
|
||||||
this->_udp->flush();
|
this->_udp->flush();
|
||||||
|
|
||||||
this->sendNTPPacket(timeout >= 3000 ? 1500 : 500, 2);
|
this->sendNTPPacket();
|
||||||
|
|
||||||
// Wait till data is there or timeout...
|
// Wait till data is there or timeout...
|
||||||
int cb = 0;
|
int cb = 0;
|
||||||
@ -177,7 +177,7 @@ void NTPClient::setPoolServerName(const char* poolServerName) {
|
|||||||
this->_poolServerName = poolServerName;
|
this->_poolServerName = poolServerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NTPClient::sendNTPPacket(uint16_t dnsTimeout, uint8_t dnsRetries) {
|
void NTPClient::sendNTPPacket() {
|
||||||
// set all bytes in the buffer to 0
|
// set all bytes in the buffer to 0
|
||||||
memset(this->_packetBuffer, 0, NTP_PACKET_SIZE);
|
memset(this->_packetBuffer, 0, NTP_PACKET_SIZE);
|
||||||
// Initialize values needed to form NTP request
|
// Initialize values needed to form NTP request
|
||||||
@ -195,7 +195,7 @@ void NTPClient::sendNTPPacket(uint16_t dnsTimeout, uint8_t dnsRetries) {
|
|||||||
// all NTP fields have been given values, now
|
// all NTP fields have been given values, now
|
||||||
// you can send a packet requesting a timestamp:
|
// you can send a packet requesting a timestamp:
|
||||||
if (this->_poolServerName) {
|
if (this->_poolServerName) {
|
||||||
this->_udp->beginPacket(this->_poolServerName, 123, dnsTimeout, dnsRetries);
|
this->_udp->beginPacket(this->_poolServerName, 123);
|
||||||
} else {
|
} else {
|
||||||
this->_udp->beginPacket(this->_poolServerIP, 123);
|
this->_udp->beginPacket(this->_poolServerIP, 123);
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ class NTPClient {
|
|||||||
|
|
||||||
byte _packetBuffer[NTP_PACKET_SIZE];
|
byte _packetBuffer[NTP_PACKET_SIZE];
|
||||||
|
|
||||||
void sendNTPPacket(uint16_t dnsTimeout = 2000, uint8_t dnsRetries = 2);
|
void sendNTPPacket();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
NTPClient(UDP& udp);
|
NTPClient(UDP& udp);
|
||||||
|
Loading…
Reference in New Issue
Block a user