Skip to content

Commit a49ba55

Browse files
committed
DNS Samples now call uip_dns_shutdown() when down with DNS
1 parent 4f73977 commit a49ba55

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

examples/SocketAppDNS/SocketAppDNS.pde

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ extern "C" {
100100
else {
101101
Serial.println("DNS query failed");
102102
}
103+
104+
// Shutdown DNS
105+
uip_dns_shutdown();
103106
}
104107

105108
// These uIP callbacks are unused for the purposes of this simple DNS example

examples/WiFiScan/WiFiScan.pde

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,9 @@ extern "C" {
311311

312312
if(20 < udpRetry++) {
313313
Serial.println("DNS TIMEOUT FALLBACK");
314+
// Shutdown DNS
315+
uip_dns_shutdown();
316+
// Send TCP packet
314317
uip_ipaddr(srvaddr, 71,231,196,153);
315318
uip_connect(&srvaddr, HTONS(7995));
316319
tcpRetry = 0;
@@ -486,6 +489,9 @@ extern "C" {
486489
uip_ipaddr(srvaddr, 71,231,196,153);
487490
}
488491

492+
// Shutdown DNS
493+
uip_dns_shutdown();
494+
// Send TCP packet
489495
uip_connect(&srvaddr, HTONS(7995));
490496
tcpRetry = 0;
491497
phase = PHASERUN;

examples/WiServerDNS/WiServerDNS.pde

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ unsigned char security_passphrase_len;
4141
// End of wireless configuration parameters ----------------------------------------
4242

4343

44-
4544
// Flag to know when the DNS query has completed
4645
boolean dnsCalledBack = false;
4746

@@ -92,10 +91,13 @@ void setup() {
9291
// Time (in millis) when the data should be retrieved
9392
long updateTime = 0;
9493

95-
void loop(){
96-
94+
void loop()
95+
{
9796
// Check if it's time to get an update
9897
if (true == dnsCalledBack && millis() >= updateTime) {
98+
// Shutdown DNS
99+
uip_dns_shutdown();
100+
// Call WiServer to fetch a page
99101
getWeather.submit();
100102
// Get another update one hour from now
101103
updateTime += 1000 * 60 * 60;

0 commit comments

Comments
 (0)