File is locked after FileStream operation

G

Guest

I have been implementing a network file transfer component using the Compact
Framework (1.1) on CE.NET 4.2 and CE.NET 5.0

The component is fairly standard, it receives data via a socket and then
writes the data to a temporary file using a FileStream. After each write the
FileStream is flushed.

Once all data is received the temporary file is renamed using File.Move.
However it appears that either CE.NET or the Compact Framework is hanging on
to the file as it remains locked for several seconds after all data has been
received and written. Any attempt to call File.Move results in an
UnauthorisedAccessException.

Just to note the CE.NET device is using a hard disk for the storage, it is
not using Compact Flash or SD Media.

A simple retry loop solves the problem, but it is odd behaviour. Has anyone
seen anything similar ?

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top