Subject: Re: MinGW port usable

From: "H. Peter Anvin" <[email-masked]>
Date: Thu, 01 Feb 2007 13:05:18 -0800

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