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.)