Windows Compilation problem

Horacio Sanson hsanson at gmail.com
Thu Jun 26 03:28:43 CEST 2008


On Fri, Jun 6, 2008 at 9:35 AM, Chris Hulbert <chris.hulbert at gmail.com> wrote:
> FYI, i just had the same problem.
> To convert from a socket to a file descriptor, you'll need to use this function:
>
>  // for win32: convert from socket to file descriptor
>  // // http://msdn.microsoft.com/en-us/library/bdts1c9x(VS.71).aspx
>  int fd = _open_osfhandle(socket,0);
>

I just encounter this same error but I am unable to solve it. My
program can create a socket() and actually connect to the server using
connect() but when I start the libev default loop an assertion ocurrs
when it calls _get_osfhandle() on line 716 of ev.c file.

How exactly am I supposed to use the _open_osfhandle() method as you
mention here?? If I use this method on the socket I get from the
socket() method then all subsequent calls on the socket (i.e. connect,
bind, listen) would return WSAENOTSOCK error.

Shall I replace all instances of _get_osfhandle() with a call to
_open_sofhandle()??  or am I missing something else??

regards
Horacio

> On Thu, Jun 5, 2008 at 6:23 PM, Marc Lehmann <schmorp at schmorp.de> wrote:
>> On Wed, Jun 04, 2008 at 04:29:46PM -0700, Matt Tolton <matt at tolton.com> wrote:
>>> Any pointers here?  The fd that I'm using is a socket obtained from
>>> the winsock socket() call.  Here is the code used to initialize it:
>>
>> That doesn't work - the libev API requires file descriptors on all
>> platforms.  What you pass in is a native opertaing system handle that is
>> not a file descriptor.
>>
>
> _______________________________________________
> libev mailing list
> libev at lists.schmorp.de
> http://lists.schmorp.de/cgi-bin/mailman/listinfo/libev
>



More information about the libev mailing list