For Programmers: Free Programming Magazines  


Home > Archive > LibWWW > May 2008 > timeout









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author timeout
Octavian Rasnita

2008-05-05, 8:02 pm

Hi,

If the network connection is broken, is there a way of setting a timeout
after which the LWP request returns?

I've seen that even if I set the timeout to 1 second, it takes much more
time until the request ends.

Thank you.

Octavian

Octavian Rasnita

2008-05-06, 5:19 am

From: "Gisle Aas" <gisle@aas.no>
> The $ua->timeout() will abort a connection attempt that takes more
> than the given number of seconds, but before LWP start the connect
> call, it looks up the hostname which can take time that's not limited
> by LWP. After the connection has been established, the timeout value
> is used to terminate requests on sockets with no activity (data coming
> back) for the given amount of time. But as long as some data comes in
> at least every timeout sec LWP will keep on processing the requests.


Thank you Gisle. Do you know if I can detect if there is no network
connection or if the requested domain was not found, using other methods
before trying to make the request using LWP?

Thank you.

Octavian

Gisle Aas

2008-05-06, 5:19 am

On Tue, May 6, 2008 at 7:27 AM, Octavian Rasnita <orasnita@gmail.com> wrote:
> From: "Gisle Aas" <gisle@aas.no>
>
>
> Thank you Gisle. Do you know if I can detect if there is no network
> connection or if the requested domain was not found, using other methods
> before trying to make the request using LWP?
>


You could try to use a module like Net::ADNS (or Net::DNS) to lookup
the hostname yourself. If you then replace the hostname with a IP
address in the URL you pass to LWP it will bypass the gethostbyname()
step that might block. You probably need to set the "Host" header in
the request manually if you do this.

--Gisle
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com