I believe I read somewhere that the timeout in the IO::Socket::INET or whatever doesn't apply to the connection, although I could be mixing my dim perldoc memories.

UPDATE: I'm right-ish see bottom of post

So, I have cobbled something out of LWP::ParallelUserAgent, where in the depths of the code, he uses a construct (shown below), there is an equivalent can_read (perldoc IO::Select) method, and these actually give working timeouts if the server / network is AWOL on my system at least

eval { die if !$sockout->can_write( $TIMEOUT ) }; #-- or : eval { local $SIG{'__WARN__'} = sub { }; #---- ignore warnings i +n the eval $fd = new IO::Socket::INET( PeerAddr => $details{'server'}, PeerPort => $details{'port'}, Proto => 'tcp') or die $@; }; if ($@) { #---- connect fail +ed $log->write('TRACE', "Can't connect TCP $@ \n") if $out; } else { my $sel = IO::Select->new( $fd ); #---- for timeout eval { die if !$sel->can_write( $TIMEOUT ) };
UPDATE : knew I'd read it somewhere

Found it: pp 114 Chapter 5 IO::Socket API, Lincoln Stein book

$val->timeout($timeout);
timeout() gets or sets the timeout value that IO::Socket uses for its connect and accept methods. (snip). The timeout value is not currently used for calls that send or recieve data...


In reply to Re: unknown socket problem by agoth
in thread unknown socket problem by Alex the Serb

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.