Wanted: An asynchronous gethostbyaddr()

Wanted: An asynchronous gethostbyaddr()

Post by Doug Siebe » Sat, 19 Dec 1992 05:44:51



As the subject line says, I'd like an asychronous gethostbyaddr().  I've got
a program that receives a number of TCP socket connects, and currently I can't
use gethostbyaddr() in that program because it blocks (sometimes for quite a
while on sites in other continents)  I don't know much about the resolver(3)
calls, but they appear as though they block until a response is received just
like gethostbyaddr().

Does anyone have code that will do this?  All I want is a name to an address,
or to know there is no name for that address that can be found.  I need to
have a socket (either UDP or TCP, doesn't matter to me) in my program so that
I know when this information arrives and I can get the hostname information I
need out of it.  I do know that nameserver calls associate an ID of sorts with
each calls, so I can keep track of that and receive my information out of
order.

As a last resort, I could get some libc source and roll my own, but surely
*someone* *somewhere* has invented this particular wheel before?  (I hope!)
Thanks for any code/help/examples/leads anyone can provide.

--
/-----------------------------------------------------------------------------\
| Doug Siebert                             | "I don't have to take this abuse |


|     ICBM:  41d 39m 55s N, 91d 30m 43s W  |  me!"  Bill Murray, Ghostbusters |
\-----------------------------------------------------------------------------/

 
 
 

1. Non-blocking gethostbyaddr wanted

Hi netters:

        Would someone please recommend a way to perform
name-resolution (i.e., from IP address "xxx.xxx.xxx.xxx" to ASCII
hostname) without using gethostbyaddr.  The problem is that
sometimes, gethostbyaddr takes quite a while to resolve an IP address,
thus hanging the process in the mean time.

        What I really want is the ability for a routine to
start a request and returning a file descriptor I can multiplex on
via "select".

        I know it is possible to fork a child process to do name
resolution and communicate to parent via a pipe when request is
available, or use resolver package function "res_search" directly
and modifying "retrans" and "retry" field to minimize amount of
time spent in blocking, but what I *REALLY* want is a
multiplexable file descriptor.

        Any ideas?  Should I read the RFC for name resolution and
write my own routine, or is there a much more painless way to do
this?

        Thanks for your help.

-- Andrew

2. Sun Ray and xdm?

3. gethostbyaddr using 0.0.0.0

4. How do you create and use configuration files...

5. gethostbyaddr not working consistently!

6. Printer filters - help

7. gethostbyaddr()

8. Two Questions about Redhat 8

9. gethostbyaddr reacts differently when using DNS

10. gethostbyaddr usage?

11. What does Linux' gethostbyaddr() want??

12. Looking for faster gethostbyaddr (another attempt)

13. gethostbyaddr()