views:

16

answers:

1

I'm using the TransmitFile API with I/O completion ports for an efficient multithreaded file server on Windows.

This all works fine, but I've now also implemented secure sockets using SChannel. Because TransmitFile streams the file directly to the socket, I don't see a way to call EncryptMessage - will I need to read the file in chunks, encrypting and transmitting them manually?

This seems a bit silly when TransmitFile is provided for the sole purpose of high performance file transfer, and secure sockets are pretty commonplace. I wonder what IIS does, considering I believe TransmitFile was implemented for IIS in the first place?

(I originally made "TransmitFile" and "EncryptMessage" hyperlinks but the spam protection only allowed one - sorry)

+1  A: 

TransmitFile is used by IIS, but not for encrypted data. I don't know what it actually does, but it is acknowledged that adding encryption will slow things down substantially.

TransmitFile uses the OS caches directly and any byte-by-byte operation (such as encryption) means that this is not possible.

I do see that IIS7 is specifically touted as improving SSL performance by doing the work in the kernel.

Steve Townsend
Alright, that makes sense. Is there a way to "lock" a socket/handle so that any overlapped operations I initiate won't actually write anything until after I unlock it?I suppose there probably isn't, but it's worth checking before I write a custom solution, which could get quite complicated.
Jamie M
@Jamie M - not that I know of - but I would post this as a new question, to ensure you get best possible info.
Steve Townsend
Ok - thanks for your help!
Jamie M