Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm porting a Unix IRC daemon (pircd) to Windows 2000.

Currently this one piece of code is holding me back:

if(($sent==length($outbuffer{$client}))|| ($! ==POSIX::EWOULDBLOCK)) { # do something }

The problem is with the ($! ==POSIX::EWOULDBLOCK) part of the condition. When a client connects, there is an error message "Your vendor has not defined POSIX macro EWOULDBLOCK". I think I have to replace that ($! ==POSIX::EWOULDBLOCK) part with something like (WSAGetLastError == WSAEWOULDBLOCK) but I'm not sure exactly how to do it.

Can anyone tell me exactly how to port this ($! ==POSIX::EWOULDBLOCK) to Windows 2000?

Thanks much, and thanks to MeowChow and Veachian64 for getting me this far.

Replies are listed 'Best First'.
(tye)Re: porting ($! ==POSIX::EWOULDBLOCK) to Windows 2000
by tye (Sage) on Dec 31, 2001 at 20:40 UTC

    Well, you can try $! == 10035 since Perl socket code puts WASGetLastError() into $! and 10035 is WASEWOULDBLOCK. However, I suspect that the code that makes the socket non-blocking won't work under Win2K.

    See Re: (to be updated) (tye)Re: Non blocking socket open for how to work around that problem.

    You might have tried searching for EWOULDBLOCK, for example, before posting.

            - tye (but my friends call me "Tye")