Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^2: how to set socket recv timeout in architecture independent manner?

by robnewton (Initiate)
on Jun 15, 2009 at 23:03 UTC ( #771822=note: print w/replies, xml ) Need Help??


in reply to Re: how to set socket recv timeout in architecture independent manner?
in thread how to set socket recv timeout in architecture independent manner?

Great, your suggestion to use the '!' modifier in pack() made my code work for 32 and 64-bit platforms. However, the '!' must come AFTER the 'L', giving:

 setsockopt( $client, SOL_SOCKET, SO_RCVTIMEO, pack('L!L!', +10, 0) );

  • Comment on Re^2: how to set socket recv timeout in architecture independent manner?
  • Download Code

Replies are listed 'Best First'.
Re^3: how to set socket recv timeout in architecture independent manner?
by gmoque (Acolyte) on Sep 06, 2009 at 17:04 UTC

    I guess another way to tackle the problem using pure Perl internals would be setting an alarm for the recv operation. This may not be most elegant piece of code but can solve a quick script.

    Just FYI I am using Cygwin and SO_RCVTIMEO does not work very good. I am on winXP (32bit) and tried ll, LL, qq, QQ

      Did you try 'VV'?


      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.

        I just tried VV and NN but fails again, do you know what time of machine Cygwin is emulating?

        I am not to concern since my scripts will run under Solaris but all my dev is done on a Win based PC. Thanks anyways

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://771822]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2017-10-21 03:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (269 votes). Check out past polls.

    Notices?