From: "Francis Cianfrocca" <garbagecat10 / gmail.com>
> 
> From what you said, this code doesn't do what you think it should do:
> 
> # hmm, io/nonblock refuses to work on windows because
> # of missing GETFL :(  Just fake it...
> if RUBY_PLATFORM =~ /mswin32/
>   class IO
>     def nonblock=(nb)
>       fcntl(Fcntl::F_SETFL, nb ? Fcntl::O_NONBLOCK : 0)
>     end
>   end
> end
> 
> That's because on Windows, this isn't the way to set sockets nonblocking.
> Microsoft reinvented a lot of wheels in Windows, and this is one of 'em. Try
> this C code instead (I'll leave it to you to turn it into Ruby):
> 
> unsigned long one = 1;
> ioctlsocket (the_socket_descriptor, FIONBIO, &one);

Right, except that in win32/win32.c, ruby corrects microsoft's
misfeatures for us, by making fcntl() on win32-ruby shunt to
ioctlsocket behind the scenes:

int
fcntl(int fd, int cmd, ...)
{
//[...]

    if (arg & O_NONBLOCK) {
        ioctlArg = 1;
    }
    else {
        ioctlArg = 0;
    }
    RUBY_CRITICAL({
        ret = ioctlsocket(sock, FIONBIO, &ioctlArg);
        if (ret == -1) {
            errno = map_errno(WSAGetLastError());
        }
    });


Regards,

Bill