50 lines
1.7 KiB
Plaintext
50 lines
1.7 KiB
Plaintext
|
|
Asynchronous DNS
|
|
----------------
|
|
|
|
Intro.
|
|
|
|
For those who write real time network applications that have to handle
|
|
multiple TCP or UDP connections, the problem of effectively doing DNS
|
|
lookups is quite real. Generally, this means the program waits while
|
|
the query finishes, holding everything else up. This small library of
|
|
routines aims to solve that problem by performing the DNS query and
|
|
then returning the program to its normal flow.
|
|
|
|
Whats included ?
|
|
|
|
The library routines, arlib.c, a header file for it, arlib.h, a man
|
|
page, arlib.3 and an example of how this sort of code is used,
|
|
sample.c.
|
|
|
|
|
|
Compilation & Installation.
|
|
|
|
Edit the Makefile and do "make install" to install things where you
|
|
wish them to go. You should check it makes and works before doing
|
|
this :)
|
|
|
|
If the compilation is successful, you'll have an executeable called
|
|
"example" and libares.a. "example" is a simple program which will
|
|
do hostname->IP# or IP#->hostnae lookups by entering either the
|
|
hostname or IP# on the line with "Host-->". You dont have to wait
|
|
for a query to fail or succeed before typing in the next line.
|
|
|
|
Portability.
|
|
|
|
I'm not sure how portable this is, it was written under SunOS 4.1.2
|
|
on a Sparc 1+ and hasn't been tested very widely. If you find any
|
|
problems when compiling/execution, plase send me a patch (using
|
|
diff -c) to avalon@coombs.anu.edu.au. If it goes well enough, I'll
|
|
send it to comp.unix.sources or comp.sources.misc for further testing.
|
|
|
|
Future additions.
|
|
|
|
Adding a working cache would be nice but I'm not sure if that really
|
|
is needed (?). I guess it depends on how often your program is
|
|
required to do a DNS lookup and whether caching would help.
|
|
|
|
|
|
Cheers,
|
|
Darren.
|