` Network: Are other stations working? (Jim Kane ) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Par2: Network: Are other stations working?
2002-06-22 -- Jim Kane
 
up or is off the network or something bad. After all that, if the only record left in sentinel, is the record you created, you are the last user. > I have a need to run an exe file that I will place on the computer with the > data files. I need to run this when my program shutsdown. This is normally a > peer to peer setup. But the program on the computer with the data files may > not startup. It may be a workstation that will need to run the program on > the computer with the data files when it shutsdown. The OS is going to be > Win98 or higher. > > I am wanting to check and possible update tables on the computer with the > data files when the last program shutsdown. I did not want to do this > activity across the network. I use a technic I call sentinel. I create a file on 'the computer with datafiles' called sentinel. It has only one record per user. When a user on a work station starts up my program, I get the computername/user name from api calls. I make a record in sentinel if no exists for the user/computer and use hold() to hold the record. Before the program ends I un-hold the record and delete it. If I want to know if there are any other users. I loop thru sentinel and try to hold each record except my own, if the hold works I delete the record because if I can hold it, the workstation that created it, GPFed or locked up or is off the network or something bad. After all that, if the only record left in sentinel, is the record you created, you are the last user. This works well because it takes care of programs that terminate abnormally. Not foolproof but close. A simplier version I use to use, there are no records in sentinel. Instead every time a workstation starts up, it opens sentinel in the readwrite,share(42H) mode. if I want to know if I'm the only one, I close(sentinel) and then try to open(sentinel,12H). If the open works, your the only user. If you want to get more fancy, use nettalk to send a message to every one and listen for responses.


Today is November 21, 2024, 8:25 am
This article has been viewed 35299 times.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: