Thanks for everyone's help with my delay problem.  The key insight was 
provided by those who noticed that the problem is related to IPV6.  I "fixed" 
the problem (well, hacked around the problem) by forcing the family in calls 
to getaddrinfo to be PF_INET.  As someone pointed out there are a lot of 
hosts on the 'net that have this deficiency, so although the ruby code is not 
incorrect, it might be a good idea to change the default behavior, at least 
for the moment.

On Tuesday 04 March 2003 06:45 pm, Seth Kurtzberg wrote:
> On Tuesday 04 March 2003 02:38 pm, Jacob News wrote:
> > [Reformatted for clarity]
> >
> > ahoward  <ahoward / fsl.noaa.gov> wrote:
> > >i see the same problem as seth.  when i run this :
> > >
> > > ruby -r socket -e 'p (Time.now);
> > > p (TCPSocket.new %q(ad.doubleclick.net), 80); p (Time.now)'
> > >
> > >249 send(3, "\314Q\1\0\0\1\0\0\0\0\0\0\2ad\vdoubleclick\3net\0", 36, 0)
> > > = 36 250 time(NULL)                              = 1046809069
> > >251 poll([{fd=3, events=POLLIN}], 1, 5000)  = 0
> >
> > Ruby is making a request for Type AAAA (ipv6) record.
> >
> > > strace dnsquery ad.doubleclick.net > strace 2>&1
> > >
> > >38 send(3, "s\332\1\0\0\1\0\0\0\0\0\0\2ad\vdoubleclick\3net\0", 36, 0) =
> > > 36 41 select(4, [3], NULL, NULL, {5, 0})      = 1 (in [3], left {4,
> > > 950000})
> >
> > Dnsquery is making a request for Type A (ipv4) record.
> >
> > Try this to see the problem:
> >
> > 	dnsquery -t aaaa ad.doubleclick.net
> >
> > which times out after 10 seconds.  The DNS server for doubleclick.net
> > is refusing to answer AAAA queries which is just plain rude, but what
> > else is new for a company who makes its money by annoying the public?
> >
> > Of course a better "solution" would be to ask getaddrinfo() to only
> > use the protocol types you are interested in (AF_INET).  A previous
> > poster demonstrated how to do this in ruby.
>
> I somehow managed to miss that email with the information about restricting
> protocol types.  If you still have it, can you forward, or can the original
> sender please resend?  TIA.
>
>   Unfortunately, there are
>
> > so many domains out there whose dns servers ignore AAAA requests that
> > using an ipv6-enabled web browser is a straight path to profanity.
> >
> > -Jacob

-- 
Seth Kurtzberg
M. I. S. Corp.
480-661-1849
seth / cql.com