[Win32utils-devel] WSAStartup failure
djberg96 at gmail.com
Tue Feb 8 23:23:51 EST 2011
On Mon, Feb 7, 2011 at 11:02 PM, Heesob Park <phasis at gmail.com> wrote:
> 2011/2/8 Daniel Berger <djberg96 at gmail.com>:
>> I added the Windows::WSA module to windows-pr recently (it's in the latest
>> git repo). However, I can't seem to make WSAStartup work. I tried the
>> following bit of code, only to get "The Windows Sockets version requested is
>> not supported" on my Vista box.
>> Is it really not supported on Vista? The docs say Win2k or later. Or is
>> there another issue?
>> require 'windows/wsa'
>> require 'windows/error'
>> require 'windows/system_info'
>> include Windows::WSA
>> include Windows::Error
>> include Windows::SystemInfo
>> version = MAKEWORD(2,2)
>> buffer = 0.chr * 532
>> err = WSAStartup(version, buffer)
>> if err != 0
>> puts "Oops: " + get_last_error(err)
> The current definition of MAKEWORD and MAKELONG is wroing.
> Here is fixed version of MAKEWORD and MAKELONG.
> def MAKEWORD(a, b)
> ((a & 0xff) | ((b & 0xff) << 8))
> def MAKELONG(a, b)
> ((a & 0xffff) | ((b & 0xffff) << 16))
Ack, thanks. I'm pretty sure I copy/pasted this, so I'm assuming
there's a precedence issue. Ruby is *usually* the same as C, so I'm
somewhat surprised here.
More information about the win32utils-devel