I have programmed a multi-user finance application in VB 6 that has been running fine for the last five years. The app is started from a file service. As I couldn’t use a database, I put my data in a bunch of differently organized files on the fileservice.
One issue I could never solve completely was doing reliable multi-user read/write access on these files. My first approach was letting the clients open the data files using the "LOCK READ WRITE" clause and handling potential "permission denied" errors following the OPEN command by trapping the error and displaying a message "File in use - try again later".
Unfortunately, this approach failed as - from time to time - two users mysteriously got "green light" to access a file at the same time - no error was triggered! - but later in the program - inevitably - some file operations led to obscure untrappable errors.
So, lastly, I designed a PB/CC app that acted as a "server". Clients had to "ask" the server for exclusive access by placing a file in a certain folder on the fileservice that was monitored by the "server" app which placed an "access ticket" with the same name, one after the other, in another folder that was in turn monitored by the waiting clients (monitoring here means regular polling).
This strategy has been working fine for five years with only a few malfunctions. My customers were satisfied and are satisfied.
Nevertheless, this solution is far from being perfect, in fact, I regard it as bloated, clumsy, far from being efficient – its only asset is that it has been working nearly flawless for years.
If I will ever have to do some change on this app I also want to solve that shared access issue in a perfect and professional manner. Unfortunately, introducing a database app which would do the low level work - safely locking and unlocking shared data - is not an option for various reasons. I must manage without additional resources in this case – that means, I have to resort to a pure PowerBasic (PB/WIN or PB/CC) solution.
Could anyone please point me in the right direction?
Heinz Salomon
One issue I could never solve completely was doing reliable multi-user read/write access on these files. My first approach was letting the clients open the data files using the "LOCK READ WRITE" clause and handling potential "permission denied" errors following the OPEN command by trapping the error and displaying a message "File in use - try again later".
Unfortunately, this approach failed as - from time to time - two users mysteriously got "green light" to access a file at the same time - no error was triggered! - but later in the program - inevitably - some file operations led to obscure untrappable errors.
So, lastly, I designed a PB/CC app that acted as a "server". Clients had to "ask" the server for exclusive access by placing a file in a certain folder on the fileservice that was monitored by the "server" app which placed an "access ticket" with the same name, one after the other, in another folder that was in turn monitored by the waiting clients (monitoring here means regular polling).
This strategy has been working fine for five years with only a few malfunctions. My customers were satisfied and are satisfied.
Nevertheless, this solution is far from being perfect, in fact, I regard it as bloated, clumsy, far from being efficient – its only asset is that it has been working nearly flawless for years.
If I will ever have to do some change on this app I also want to solve that shared access issue in a perfect and professional manner. Unfortunately, introducing a database app which would do the low level work - safely locking and unlocking shared data - is not an option for various reasons. I must manage without additional resources in this case – that means, I have to resort to a pure PowerBasic (PB/WIN or PB/CC) solution.
Could anyone please point me in the right direction?
Heinz Salomon
Comment