Hello
I am coding an application which consists of a webservice and a client
application.
I am comparing the files on the server and the one on the client with
hash-code and dates, so I can synchronize. That is working correctly.
My problem is, if I am deleting one file on the client, then synchronize,
how does the server know that it has been deleted? Actually it is then
copying it back again to the client...
The problem occurs specially if I am using 2-3 clients to synchronize. If I
then delete the file on one client, but then make some changes to the file
on another client, then I am synchronizing client 1 and then client 2, it
should keep the new client 2-version!
So I should be able somehow to know when the file has been deleted...
Or is there another approach?
Thanks
Sven
Dale - 13 Nov 2006 06:14 GMT
It isn't real clear from your post if the server is writing directly to the
client or not or if the client is getting the file from the server and then
saving it. Without more information it is hard to say exactly but, assuming
it fits for your circumstance, the FileSystemWatcher class will allow you to
automatically detect when a file is changed, added, or deleted.
HTH
Dale

Signature
Dale Preston
MCAD C#
MCSE, MCDBA
> Hello
>
[quoted text clipped - 19 lines]
>
> Sven
Ciaran O''Donnell - 13 Nov 2006 13:24 GMT
You will need to have the app running all the time, probably as a service,
and use the FileSystemWatch to record all the changes. Then you can send all
lists to the server and let is figure out what to do to sync
Ciaran O'Donnell
> Hello
>
[quoted text clipped - 19 lines]
>
> Sven
Dale - 13 Nov 2006 20:14 GMT
Or you can take a mixed approach. Use the FileSystemWatcher to catch
immediate changes and use a timer to trigger incremental scans of the watched
folders to check for changes made while the app is not running. The latter
is similar to what Windows Media Player does.
Of course if real time knowledge of changes is required and there are
serious financial or business implications then neither the FileSystemWatcher
or a triggered event may be adequate. In those cases, it might be better to
manually check the file system before making whatever decisions in the
workflow are based on the file being changed or deleted or not.

Signature
Dale Preston
MCAD C#
MCSE, MCDBA
> You will need to have the app running all the time, probably as a service,
> and use the FileSystemWatch to record all the changes. Then you can send all
[quoted text clipped - 25 lines]
> >
> > Sven