in reply to ioctl for non-blocking and blocking in Windows

salva claims in Re: Non-blocking socket read on Windows that
ioctl($socket, 0x8004667e, $nonblocking); $nonblocking = 1 => makes the socket non blocking,
$nonblocking = 0 => makes the socket blocking.
So he's not using a scalar reference...

I also found use of the magic number in a CPAN module, Win32::Socketpair, again, by salva. Again, not using a reference.

p.s. in my internet search I stumbled across a rather interesting recent blog post.

Replies are listed 'Best First'.
Re^2: ioctl for non-blocking and blocking in Windows
by Anonymous Monk on Apr 16, 2007 at 17:36 UTC
    my $nonblocking = 1; ioctl($sock, 0x8004667e, $nonblocking) or die "ioctl socket: $!\n"; my $sockread = sysread($sock, $buffer, $chunk); #should be non-blockin +g $nonblocking = 0; ioctl($sock, 0x8004667e, $nonblocking) or die "ioctl socket: $!\n"; $sockread = sysread($sock, $buffer, $chunk); #should block
    The code above produces the helpful error message: "ioctl socket: Unknown error." I got rid of the die part and the socket was still blocking on the first read. If I replace $nonblocking with \$nonblocking, both reads are non-blocking. I, too, stumbled across that blog post and it seems to agree that you must pass ioctl a reference as the last argument.