-->
Page 1 of 1

DNS resolution for UDP?

PostPosted: Wed Jul 15, 2015 5:29 pm
by smily77
I like to display the time with my ESP8266 using the NTP-Time. There are some examples in the forum so this isn't a problem with the Arduino IDE. But all examples uses a fixed IP while I would like to use the ntp server pool but this require to resolve the DNS (0.ch.pool.ntp.org in my case).

How can I do that?

Re: DNS resolution for UDP?

PostPosted: Thu Jul 16, 2015 10:23 am
by martinayotte
If you look at the example esp8266/libraries/ESP8266WiFi/examples/NTPClient/NTPClient.ino, you will see that it is using WiFi.hostByName(ntpServerName, timeServerIP) function to get the IP of the NTP server and then calling sendNTPpacket(timeServerIP) provided in the sketch followed by a udp.parsePacket()

Re: DNS resolution for UDP?

PostPosted: Thu Jul 16, 2015 9:59 pm
by SwiCago
Check this guys post...
viewtopic.php?f=29&t=4060
proteus74 wrote:Hi,

for those, who are interested:
I've build an easy webconfig system for the ESP.

Features :
    Easy configuration of IP-Address, Netmask, Gateway, SSID and password for your router
    Build-In NTP Client (especially when you want to build a clock), with timezome and daylight saving support
    Realtime clock structure for having a convinient way to access the date/time
    Turn On/Off things at a given time (e.g. for lamps)
    Administration-page will not be accessible after a given time in ESP AP-Mode
    Simple AJAX Support (microajax)
    HTML pages can be added in a differnt (.h-) file and are stored in Progmem.

http://www.john-lassen.de/index.php/pro ... -webconfig

Feel free to use it in your projects.

proteus74

Re: DNS resolution for UDP?

PostPosted: Fri Jul 17, 2015 3:08 am
by smily77
Thanks a lot

I was looking in an old version