(10-24-2024, 09:22 PM)Justin Case Wrote: Daft Question (forgive me!) what is WriteFile() ? - Is this the gift that we've all been waiting for for many years?
WriteFile() has existed for a very long time, going way back to at least Indy 8, if not earlier (before my time).
(10-24-2024, 09:22 PM)Justin Case Wrote: a simple way of sending a file without worrying about streams and all that malarky?
WriteFile() is a wrapper for the Win32 TransmitFile() API on Windows, which takes an open file handle and dumps the file data directly onto a socket. If Indy is running on a Windows NT-based system (which includes anything after W2K/XP), and the AEnableTransferFile parameter is true (among other conditions), then WriteFile() opens the file with CreateFile() and sends it with TransmitFile(). Otherwise, it just uses a TFileStream and sends that instead. Either way, no preceding size is sent.
(10-24-2024, 09:22 PM)Justin Case Wrote: If it is then how come there is no ReadFile() ?
Because there is no corresponding Win32 API to receive a transmitted file from a socket. So you just have to use ReadStream() instead.

