It appears from the help file that the FileStream class has an accessible "WriteTimeout" property. The write path for the file is the flash (SD) card on the device.
I wrote some test code using standard FileStream and Binary Writer objects to check what the default timeout was and came up with the exception listed at the foot of this message in response to the code below. The code is for a Pocket PC under the .Net Compact Framework 2.0.
Why are timeouts not supported on this stream Do I need to override the "CanTimeout" property to work around this Is it because the target device is a flash memory card Note that there does seem to be some kind of inherent timeout occurring (I haven't measured it exactly but its over 5 seconds).
----------------------------------------------------------------------------------
Dim fs As New FileStream(fullFileName, FileMode.Create)
MessageBox.Show("FileStream Timeout = " & fs.WriteTimeout.ToString)
Dim binWriter As New BinaryWriter(fs)
----------------------------------------------------------------------------------
System.InvalidOperationException was unhandled
Message="Timeouts are not supported on this stream."
StackTrace:
at System.IO.Stream.get_WriteTimeout()
at PLCCommander2.frmUploadFile.UploadFileData()
etc.
etc.

FileStream Write Timeout Read Exception
SonAsylum
Should user remove the card in the middle of the operation, you would get an exception.
I would agree with you on buffering, that’s probably the case. And yes, it's a good idea to flush buffer from time to time. Perhaps it can be connected to completion of certain operation within your application.
Olle SW
I'd guess, therefore, that the delay I am experiencing is caused by the the filestream buffering. i.e. waiting for a full buffer before the next write to disk. The solution is probably to flush the buffer occasionally.
QWERTYtech
Though it seems to me that this is a disadvantage... a timeout and a TimeoutException would be nice to have...
Jeremy Grand
AFAIK timeouts are only supported on network steams. Timeouts on a file stream do not really make sense, that’s the case with desktop as well.