One possibility is that the first nameserver in your resolv.conf is slow/broken 
and gethostbyaddr() (which is typically synchronous) has to wait for it to 
timeout before moving on.  dig, by contrast, will usually send out the request 
to all your NSs at once and use whatever reply comes back first.

-Sara
  ----- Original Message ----- 
  From: Eric Coleman 
  Newsgroups: php.internals
  To: PHPdev 
  Sent: Friday, April 07, 2006 7:42 AM
  Subject: gethostbyname vs. dig


  Don't mean to piss anyone off or ask a question that doesn't belong  
  here but here it goes:

  I wrote a script to check that domains resolve to our ip's.  I  
  noticed, that using gethostbyaddr() is significantly slower than using

  dig domain.com A +short

  Just curious as to why this is.

  Eric

Reply via email to