What is the simplest way to get IP address of a domain?
We're developing an embedded application, running on a standalone GPRS connected device (no operating system there). We are trying to get an IP address of domain name. I think that we should use some public DNS service, like Google DNS (8.8.8.8
). The question is - what is the simplest request we should send to 8.8.8.8:开发者_运维百科53
in order to receive IP address of our domain?
Again, we can't use libresolve
or any other similar libraries. We will make a simple TCP connection to port 53
of Google DNS, and will format our request ourselves.
I tried to understand RFC1053 myself, but failed. Too many words :)
I'm not a DNS expert in any way, but I thought that DNS generally use UDP rather than TCP?
Either way, here's a link to a page that describes the communication using less words that might be easier to understand than the RFC itself.
Also, even if you can't use the libresolve library itself, can't you look at an open source version of that library and use the code from one of those (assuming that the license is compatible with your work). Here's one from Apple that I found via google.
精彩评论