Advertisement

gethostbyaddr timeout?

Started by March 27, 2003 12:12 PM
2 comments, last by Zoomby 21 years, 10 months ago
hi! Is it possible to change the timeout of gethostbyaddr()? If you want to make a lookup and no name is found, it takes 3 seconds. bye chris
The function gethostbyaddr() sends a UDP request packet to your DNS server for a 'reverse lookup query'. If the DNS server doesn't have the entry in cache it must fetch it on the net. Meanwhile your application must wait for the response, hence the time delay.

I don't see any entry in the Win2K registry that pertains to DNS negative hits delay setting. Maybe WinXP/Pro or Linux may have kernel variables to set. I don't see any information in the UDP packet specs that would indicate a time delay limit. Sorry, but I think this is not something an application has control over since it is tied to the OS kernel and the DSN protocol specs.

-cb

[edited by - cbenoi1 on March 27, 2003 1:55:11 PM]
Advertisement
hi

I just modified a dns lookup app I wrote to get records from reverse queries. It works fine, and if there is no name for a address I get a (wrong) SAO record, but it''s still fast. I wonder why the gethostbyname is so slow!? Any idea?

bye
chris
Remember that it takes time to fetch the first query; afterwards it should be in the DNS's cache to make it faster for the following requests. I agree that *3 seconds* is a little too long and it smells like a library bug.

-cb

[edited by - cbenoi1 on March 27, 2003 4:03:17 PM]

This topic is closed to new replies.

Advertisement