Query DNS esp8266 using Arduino IDE
Posted: Fri Aug 12, 2016 7:37 am
I am trying to query the IP of remote urls but can't figure out how to do it with the Arduino IDE.
In lua it's something like this:
In shell its
that returns:
How do i do the same thing using the Arduino sketch?
In lua it's something like this:
Code: Select all
sk=net.createConnection(net.TCP, 0)
sk:dns("www.domain.com",function(conn,ip) print(ip) end)
sk = nil
In shell its
Code: Select all
dig www.domain.com
that returns:
Code: Select all
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24980
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;www.domain.com. IN A
;; ANSWER SECTION:
www.domain.com. 30 IN CNAME domain.com.
domain.com. 30 IN A 169.45.92.196
How do i do the same thing using the Arduino sketch?