bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Winsock wrappers


From: Simon Josefsson
Subject: Re: Winsock wrappers
Date: Fri, 10 Oct 2008 14:33:30 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux)

Bruno Haible <address@hidden> writes:

> Simon wrote:
>> Is there any way for gnulib to detect that a fd was created by gnulib's
>> winsock wrappers or the native systems?
>
> Actually these two are different types: gnulib's file descriptors are 'int'
> in the small nonnegative range, whereas a SOCKET is actually a HANDLE that
> can be passed to ReadFile and WriteFile.
>
>> >>> More or less.  Actually, the flag could be just "use send/recv or
>> >>> read/write?" because of what I said above, and that means that it could
>> >>> be done without including lib/winsock.c or other similarly unwanted
>> >>> baggage into gnutls.
>> >> 
>> >> Are you saying that read/write on the socket would work under Windows?
>
> Here's a matrix:
>
>                       |  native fd    |   gnulib      | native SOCKET |
>                       |               |  wrapped fd   |               |
> -----------------------------------------------------------------------
> ReadFile, WriteFile   |               |               |      YES      |
> -----------------------------------------------------------------------
> MSVCRT recv, send     |               |               |      YES      |
> -----------------------------------------------------------------------
> MSVCRT read, write    |     YES       |     YES       |               |
> -----------------------------------------------------------------------

Thanks.  Is there a place in the gnulib manual to add this?

I searched for your _WIN32/CYGWIN/etc CPP macro matrix yesterday, and
having that in the gnulib manual as well would have saved me time.
Assuming you and others feel it is appropriate, of course.

>> Then the GnuTLS ABI doesn't depend on how gnulib have implemented sockets
>> under Windows.
>
> There was only really one boolean choice in how gnulib supports sockets:
> either as SOCKET (in the past) or as 'int' (like on Unix, now).

But the internal gnulib implementation might change, right?  I mean, the
FD_TO_SOCKET macro is an implementation detail in gnulib, but if that
ever changes, it would break binary compatibility if GnuTLS exposes the
SOCKET vs int difference.  Maybe I misunderstood though.

/Simon




reply via email to

[Prev in Thread] Current Thread [Next in Thread]