Re: setting the UserAgent timeout...
Todd Strichuk (todd@mda.ca)
Thu, 2 Jul 1998 13:13:01 -0700
> taken from Gisle Aas (Jul 02)...
>There is a bug in the IO modules that comes with perl5.004_04 that
>make connect timeout not work as it should. Try to test with the
>following one-liner:
>
>$ perl -MIO::Socket -le 'IO::Socket::INET->new(PeerAddr => "www.host.com:80", Timeout => 10) || die'
>
>If this fails to timeout, upgrading the IO modules might help.
thanks for the advice. i am indeed using perl5.004_04. i tried your
example above with the host that was giving me problems...
perl -MIO::Socket -le 'IO::Socket::INET->new(PeerAddr => "164.214.2.59:80", Timeout => 10) || die'
but it seems to work fine (i get a response back within about 1
second). however, i noted the timeout problem when the server that i
was trying to connect to was having problems (i think it was shut
down). when the server is running, i don't seem to have any problems
with the timeout feature. it's hard for me to replicate the problem
as the server in question is a u.s. government computer system - and i
can't really ask them to take it off line so i can do my testing. ;)
i think you've given me a good lead tho. i'll let you know if i track
down the problem.
>Todd Strichuk <todd@mda.ca> writes:
>
>> does anyone know how to properly set the user agent timeout? i've
>> tried the obvious...
>>
>> $agent = new LWP::UserAgent;
>> $agent->timeout(10);
>> $request = new HTTP::Request( 'POST', $url->base . $url->epath );
>> $request->content_type('application/x-www-form-urlencoded');
>> $request->content($url->equery);
>> $response = $agent->request($request);
>>
>> but when i put some print statements before and after the
>> $agent->request() call i find that it can still take up to 7 minutes
>> before i get a response if the server i'm trying to connect to is
>> down. besides the timeout() call, the above code actually works and
>> will give me some results eventually. the only problem is that i
>> can't afford to wait very long for the results and would like to cut
>> it short. can anyone offer some advice?
--
todd
Have you seen Quasimoto lately? I have a hunch he's back!