[svlug] gethostbyname()

Erik Fears strtok at softhome.net
Sat Jan 26 20:05:02 PST 2002

Not a specifically linux related question, but a unix related question
(although development is on linux).

I'm part of a development team developing a SQL based DNSbl
for open proxies (for mail servers, irc servers, etc).

Anyway one of the clients for the database checks remote hosts connecting
to a server to determine whether or not they use an open proxy. One of the 
checks uses the unix gethostbyname() function to resolve the host against
a DNS blacklist. 

The problem I found is that gethostbyname() blocks ( I have no idea what the
timeout is ). I'm wondering if any linux C programmers (or UNIX programmers)
on this list know a way to resolve a host in a way that will not block 
(without using a seperate thread, or writing the DNS client from scratch).

Erik Fears. 

More information about the svlug mailing list