in reply to Locked threads and tcp timeouts

  1. Timeout option in socket constructor is related to connect/accept calls so it's useless for me

    See how to set socket recv timeout in architecture independent manner? for how to set the recieve timeout.

  2. trick with eval/$SIG{ALRM}/alarm() don't work on ActiveState Perl (AFAIK ALRM signal is not supported)

    alarm *does* work on win32 (since 5.8.0 I think), but it doesn't interrupt reads because of SAFE SIGNALS

  3. Is there any other way?

    You could also resort to non-blocking IO. See How to set sockets non-blocking on Windows


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Replies are listed 'Best First'.
Re^2: Locked threads and tcp timeouts
by menth0l (Monk) on Feb 16, 2012 at 13:19 UTC
    See how to set socket recv timeout in architecture independent manner? for how to set the recieve timeout.
    I have read this thread but it didn't do any good for me. Suggested line:
    setsockopt( $client, SOL_SOCKET, SO_RCVTIMEO, pack('L!L!', +10, 0) );
    didn't help, perl still blocks at reading from socket. Maybe the 64-bit env is the reason?
    You could also resort to non-blocking IO. See How to set sockets non-blocking on Windows
    Thanks, i'll look into it.
    A reply falls below the community's threshold of quality. You may see it by logging in.