Re: what is my dns ip address
| From: | Olav Mørkrid | Date: | Mon, 03 Sep 2007 05:09:39 +0000 |
| Subject: | Re: what is my dns ip address | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-261627@lists.php.net to get a copy of this message | ||
the source of the problem is gethostbyaddr(). it seems to have a 4,5
second timeout, so some lookups time out after 4,5 seconds, while most
of them are resolved in < 0.1 second; a radically performance
difference.
the user written gethostbyaddr_timeout() on the gethostbyaddr man page
overcomes this problem, but unlike gethostbyaddr() requires a specific
dns address, which seems unavailable from php at the moment.
parsing nslookup and similar things seems like a workaround. where
does one propose a dns_ip() function which returns the system's
default dns ip address?
or better yet, to add a timeout value to gethostbyaddr(), or in some
other way ensure that lookups return quickly, whether they have an
answer or not.