On Mon, Jul 16, 2012 at 11:39 AM, Heiko Hund <heiko.h...@sophos.com> wrote:
> Hi Alon
>
> On Friday 13 July 2012 20:00:49 Alon Bar-Lev wrote:
>> In my projects I always compare to the two values EWOULDBLOCK and
>> EINPROGRESS and it works without much conditionals.
>>
>> So simply do:
>> ---
>>   if (status == EINPROGRESS || status == EWOULDBLOCK)
>
> While this surly compiles with mingw, I don't think it works as intended, as
> the numerical values of the constants differ:
>
>         #define EWOULDBLOCK 140       (errno.h)
>         #define WSAEWOULDBLOCK 10035L (winerror.h)
>
> The error returned from WinSock2 is really 10035 in case of a unfinished non-
> blocking connect.
>

Hi,

That's correct.... and applies to all winsock errors in this case:
---
#define WSAEWOULDBLOCK 10035L
#define WSAEINPROGRESS 10036L
---

It depends if you take error from errno or from
GetLastError()/WSAGetLastError().
If we do not use errno, we can have autoconf to define emulation for
errno as WSA constants.

Alon.

Reply via email to