(Running AS 5.8.6 on WinXP)

I'm trying to set a socket to nonblocking mode:

use IO::Socket::INET; my $sock = IO::Socket::INET->new( PeerAddr => 'peer', PeerPort => 9876, Proto => 'tcp', Type => SOCK_STREAM, Blocking => 0 ) || die $!; $sock->close();
It always dies (tho the error seems to flip around between
Bad file descriptor at iosock.pl line 3.
and
IO::Socket::INET: ...propagated at iosock.pl line 3.
After stepping into IO::Socket::INET, the failure is always on the $sock->blocking() call.

I found node Re: Net::SSH::Perl error message, which points to an old activestate bug report that essentially says I'm SOL.

  1. Does this Win32 nonblocking sockets issue still exist ?
  2. If so, is there a known workaround for trying to send() large buffers wo/ blocking for an extended period ? Is there a way to safely shut off the offending SO_SYNCHRONOUS_NONALERT socket option after connecting, and then setting $sock->blocking(0) ?

Update:

Once again, I posted too soon. After changing my supersearch terms, I found Re^2: nbtstat.pl fails for non-windows IP, which provides a number of pointers, esp the ioctl(). Hopefully it will work as advertised...


In reply to Nonblocking sockets on Win32 by renodino

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.