Fellow monks,

I am trying to implement a HTTP-Request (GET) to an unreliable server. The problem is that the server will occasionally deadlock and the request will never succeed. That is the programm runs forever.

Update

To clarify the problem: connect is succesfull (200 OK). But while retrieving the content of the response, the server stucks. Then the connection hangs forever.

I just want to skip the blocking page, that is terminate that request on my side, and do the next request or stop the programm.

DNS is working fine.

Setting a timeout ( $ua->timeout() ) or an alarm doesn't work.

I am aware of Get Timout with LWP which adresses the same problem.

There's a similar thread at StackOverFlow: True timeout on LWP::UserAgent request method which suggests using SigAction.

Is there a convenient way to put LWP::UserAgent or WWW::Mechanize in nonblocking mode (like IO::Socket::INET )?

Update

As of perrin's reply:

I've tested it on a W2003 Server with Activstate Perl 5.8.8 and 5.10.0.1004 and on Linux 2.6.24-19-generic with Perl 5.8.8 and 5.10.

Thomas


In reply to True timeout (nonblocking) on LWP::UserAgent request method? by tomfahle

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.