[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Winsock wrappers
From: |
Bruno Haible |
Subject: |
Re: Winsock wrappers |
Date: |
Fri, 10 Oct 2008 13:16:46 +0200 |
User-agent: |
KMail/1.5.4 |
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 | |
-----------------------------------------------------------------------
> However, it is rather simple for applications to write these wrappers
> themselves, so I think it is better to document how to do that.
There are only two choices: Either the API takes 'int' file descriptors,
or it takes SOCKET entities. A boolean is perfectly adequate in this
situation, and easier to understand for the user than potential wrapper
functions.
> 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).
Bruno
- Winsock wrappers, Simon Josefsson, 2008/10/08
- Re: Winsock wrappers, Bruno Haible, 2008/10/08
- Re: Winsock wrappers, Simon Josefsson, 2008/10/09
- Re: Winsock wrappers, Paolo Bonzini, 2008/10/09
- Re: Winsock wrappers, Simon Josefsson, 2008/10/09
- Re: Winsock wrappers, Paolo Bonzini, 2008/10/09
- Re: Winsock wrappers, Simon Josefsson, 2008/10/09
- Re: Winsock wrappers, Paolo Bonzini, 2008/10/09
- Re: Winsock wrappers, Simon Josefsson, 2008/10/09
- Re: Winsock wrappers,
Bruno Haible <=
- Re: Winsock wrappers, Simon Josefsson, 2008/10/10
- Re: Winsock wrappers, Paolo Bonzini, 2008/10/10
- Re: getaddrinfo and sa_len, Bruno Haible, 2008/10/10
- Re: predefined CPP macros, Bruno Haible, 2008/10/10