Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: Locked threads and tcp timeouts

by menth0l (Monk)
on Feb 16, 2012 at 13:19 UTC ( #954224=note: print w/ replies, xml ) Need Help??


in reply to Re: Locked threads and tcp timeouts
in thread Locked threads and tcp timeouts

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.


Comment on Re^2: Locked threads and tcp timeouts
Download Code
Re^3: Locked threads and tcp timeouts
by sundialsvc4 (Abbot) on Feb 16, 2012 at 13:34 UTC

    If it were me, I would use non-blocking I/O here as a matter of routine procedure, that is, if the exchange with the client under normal circumstances is not so intricate that you want to use a thread to most easily keep track of its individual state.   Physically speaking, the computer is moving a lot of packets, one at a time, through probably a single NIC card:   all of the business of “sockets” is a software, not a hardware artifice.   They are “slots in the mail room,” if you will, not actual things.   I think that you will most often be more pleased with the non-blocking design, than with one that uses threads.

      Why do you keep spouting the same, groundless, unfounded, garbage?

      Didn't you read the clear & unequivocal data I posted in response to the last time you spouted this tosh, that completely refutes it?

      It is beginning to feel like Groundhog Day around here.

      Have you heard the one that goes something like: Doing [saying] the same thing over and over again and expecting a different outcome, is either first sign of madness or senility.


      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?

        Doing saying the same thing over and over again and expecting a different outcome, is either first sign of madness or senility.

        I am in no way arguing against your expertise in threaded programming nor defending sundial's statements. I just can't stand that cliché. Please forgive my interruption.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://954224]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2014-12-18 11:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (50 votes), past polls