[Box Backup-dev] Reviewing code -- help!
Charles Lecklider
boxbackup-dev@fluffy.co.uk
Thu, 08 Dec 2005 17:55:50 +0000
Chris Wilson wrote:
>>> > WinNamedPipe::Write may not work in edge cases where it doesn't
>>> write > all the bytes given.
>
> According to MSDN, if I read it correctly, WriteFile will not do partial
> writes, but block until it's written everything (or an error occurs).
> There's no way to get the number of bytes written back from it.
>
> [http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/writefile.asp]
lpNumberOfBytesWritten
[out] Pointer to the variable that receives the number of bytes
written. WriteFile sets this value to zero before doing any work or
error checking.
How it behaves with partial sends depends on the mode the pipe is in. I
strongly suggest using message mode; as long as your sends are within
the buffer size, you can be sure both ends are in the same state.
-C