On Tue, 8 Jun 2004 07:15:08 -0700, "Oin Zea" <Oi****@hotmail.com>
wrote:
So I French, what will you suggest me do? what I need done is for 3 to 4
computers to access a client file in real-time. all pc can create, edit, and
delete clients from that file.
Ok,
The really safe way is to open the file in 'lock write' mode before
every update, then close it after the update
The time hit will not be that great.
If you really want to keep the file open, then I suggest that you
pre-format it
- eg: write loads of blank records so that the file is never extended
during normal use
This means that the FAT info and the important directory info will not
change.
I would also have a status field in each record,
eg: unused, locked, etc
Also: store the update person and DateTime in each record
Then use another file that you open in deny write mode, write in the
name of the updater, then 'lock' the individual record that a user is
going to update. It then closes the deny write file.
That is what we called the 'Block-Lock' approach
The effect is that a user goes to a record and sees:
'Record XXXXX is in use by User YYYYYY'
You need to be incredibly careful when adding records, as there must
be no possibility of one user overwriting a new record.
I would do that while the system is 'Blocked'
Anyway - the general idea is that a separate file is physically locked
to act as a semaphore for all the other users.
I would suggest that you experiment with locking files and watching
multiple processes contesting for access.