Re: transmitFile() function
"CppSavvy" wrote:
I know about handles and sockets and I know how to use the
function on
regular files. I already have the program running.
However, I want to imporve
the performance by caching the files, for if they were
accessed again they
would be in the RAM already, and the file can be
transferred immediately
without accessing the HDD. So, I just want to know if I
have to do something
extra to use the function on memory-mapped files. And if
an example can be
added that would be perfect.
So, it appears that TransmitFile is wrong choice for that.
TransmitFile was invented with sole purpose to avoid file
buffering in user mode. It doesn't care whether file is
mapped or not. TransmitFile opens the file in kernel mode
and transmits it through a socket, thus avoiding roundtrip
to user mode. That's all. You just don't have enough control
over TransmitFile (besides FILE_FLAG_SEQUENTIAL_SCAN flag)
to tell it what to do with the file.
HTH
Alex