Re: Simple DNS query

Matti Aarnio (matti.aarnio@sonera.fi)
Fri, 28 May 1999 02:33:17 +0300


On Tue, May 25, 1999 at 07:07:04PM -0300, Juan Carlos Castro y Castro wrote:
> I tried to browse the RFCs and went insane. Now that I'm back from the
....
> I want to write a VERY small, VERY dumb function that just asks one
> query to one DNS server: What's (if any) the address of host
> thishost.thisdomain.xx? Yes, I want a minimalist gethostbyname (for an
> internet-enabled small device).

There is no such an animal as "minimalist" DNS lookup routine.

Your best bet is to pick bind-8.2.* sources, and dig out
the libbind or libresolv (which name it happens to be)
sources which contain gethostbyname() implementation.

You can't remove very much out of that code.

> Its parameters should be the IP of the DNS server and the fully
> qualified host name. I'd like the server to go fetch the address on
> others servers it knows about. What do I do?

Usually that DNS server referral is stored into /etc/resolv.conf
file, and thus you can do away without using codes to scan that
configuration file by supplying the server address as a parameter.

> Thanx all,
> \ / | Juan Carlos Castro y Castro - jcastro@appi.com.br |

/Matti Aarnio <matti.aarnio@sonera.fi>
-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.rutgers.edu