From: H. Peter Anvin Date: Thu, 01 Feb 2007 21:05:18 GMT Subject: Re: MinGW port usable Message-ID: <45C2560E.6090504@zytor.com> In-Reply-To: <45C1C24A.471F40AD@eudaptics.com> Johannes Sixt wrote: > "H. Peter Anvin" wrote: >> Johannes Sixt wrote: >>> (*) The reason is that on Windows read() and write() cannot operate on >>> descriptors created by socket(). A work-around is to implement a (threaded) >>> proxy, but that's almost the same as if netcat were used as >>> GIT_PROXY_COMMAND. >>> >> Actually, I believe it can for the NT series kernels (at least 2000 or >> later, not sure about the earlier ones), but not for the DOS-based ones. >> >> The trick is to use _open_osfhandle() to convert the file handle (a >> WinAPI construct) to a file descriptor (which in Windows is a construct >> of the C library.) > > I tried this, but it doesn't seem to work. I get an EINVAL at the first > write() to the socket. I conclude that the things returned by socket() > are not WinAPI file handles that are valid for WriteFile(). :( > Except they are (for NT-based Windows), so you're doing something goofy. This is a widely used construct, so it can't be that broken. -hpa