bug-gnulib
[Top][All Lists]
Advanced

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

Re: read() and write() for MinGW


From: Paolo Bonzini
Subject: Re: read() and write() for MinGW
Date: Mon, 29 Mar 2010 10:59:06 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b2pre Thunderbird/3.0.3


Conceptually this is extremely simple, and I've found that gnulib
already contains useful bits like SOCKET_TO_FD, FD_TO_SOCKET, and the
code for determining if an arbitrary fd is a socket - which is all
great.

Yes, and the read() and write() functions don't need to make this
distinction, because they call ReadFile and WriteFile, which work
equally fine with HANDLEs and SOCKETs.

... but not for all sockets, only those created by gnulib's socket:

  /* We have to use WSASocket() to create non-overlapped IO sockets.
     Overlapped IO sockets cannot be used with read/write.  */
  fh = WSASocket (domain, type, protocol, NULL, 0, 0);

Neil, can you make sure that all your sockets are gnulib-created?

((defined _WIN32 || defined __WIN32__)&&  !defined __CYGWIN__) is the
solution. (HAVE_WINSOCK2_H&&  !defined __CYGWIN__) would be equivalent.

Agreed.

Paolo




reply via email to

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