Dmitry Timoshkov a écrit :
"Eric Pouech" <pouech-eric(a)wanadoo.fr> wrote:
+ <title>File management</title> + <para> + With time, Windows API comes closer to the old Unix paradigm "Everything + is a file". Even if it grew better over the years, it's still not 100% + there (for example, you cannot use <function>ReadFile()</function> over + a socket handle).
Is it really true?
From MSDN:
BOOL ReadFile( HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped );
Parameters hFile [in] Handle to the file to be read. The file handle must have been created with the GENERIC_READ access right. For more information, see File Security and Access Rights. For asynchronous read operations, hFile can be any handle opened with the FILE_FLAG_OVERLAPPED flag by the CreateFile function, or a socket handle returned by the socket or accept function.
which means that ReadFile() only works on socket for async reads, not sync reads. I'll precise this. A+ -- Eric Pouech