Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Nonblocking sockets on Win32

by renodino (Curate)
on Nov 29, 2005 at 00:07 UTC ( #512440=note: print w/replies, xml ) Need Help??


in reply to Re: Nonblocking sockets on Win32
in thread Nonblocking sockets on Win32

Ahh, thnx, that did it...with one tiny change: I had to explicitly clear $! before the call; apparently, ioctl() isn't clearing it on its own.

I had tried a similar recommendation which said the param value had to be a ref:

$nonblock = 1; ioctl($sock, POSIX_FIONBIO, \$nonblock); # !!WRONG
but that would only set nonblock, but couldn't set back to blocking.

And an FYI: this worked with a IO::Socket::INET handle.

Replies are listed 'Best First'.
Re^3: Nonblocking sockets on Win32
by rob_au (Abbot) on Nov 29, 2005 at 10:29 UTC
    This node is also particular informative - Re: (to be updated) (tye)Re: Non blocking socket open - I used some of the code therein to build a cross-platform, non-blocking network event engine which has proven to be particularly robust since deployment.

     

    perl -le "print unpack'N', pack'B32', '00000000000000000000001000000000'"

      Thnx, I saw that prior to ikegami's pointer, but some of the comments scared em off. Now that I grok the ioctl() bit, the other part now makes more sense.

      The delta is the nonblocking connect() which (hopefully) I won't need anytime soon. (tho I may have a use for it in another app for which some users have griped about wanting a smaller timeout when the peer isn't available.)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2018-11-15 05:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (180 votes). Check out past polls.

    Notices?