Article View: comp.os.msdos.programmer
Article #398Re: Writing a program to run on a Novell network
From: Leonard Erickson
Date: Wed, 12 Aug 1992 02:13
Date: Wed, 12 Aug 1992 02:13
42 lines
2724 bytes
2724 bytes
dmeredit@nyx.cs.du.edu (Don Meredith) writes: >I have been tasked with writing a time keeper program for my company. My >question is do I have to do anything special for the program to be able >to run on a Novell network? It is being written in C using Borland C++ >3.1. It will open and close files. Everybody will be able to run it. Yes you do. Because if everyone can use it, that means that several people can try to access the program's data files at the same time. Novell's default behavior (as well as that of most compilers) is to deny access to a file to all but the first user. Anybody else has to wait until the current user quits using it. There are several options. First if the file only needs to be read, you can tell your program to open the file in for reading only in a shareable mode. That way *everybody* can read it, but no one can write to it while anyone is reading it. Second, is to only open files that need to be written to for long enough to do the write. Basicly you keep trying to open the file for write-exclusive until you either succed or time-out. Then you do your write, and release the file *immediately, so that someone else can have their turn. (this is "file-locking") Third, you can use record-locking. This requires that either *you* know Novell internals pretty well or you use a library that knows how to do Novell record locking.\ With this, you try to "lock" the record that you need to add/update. Then you can do whatever you like without denying acces to the *rest* of the file. To avoid contention problems, it is common to read the record, store a copy of it in RAM, create the new/updated record. *then* do the lock. At this point you compare the stored copy with the current contents of the record. If they match. Write your data and you are done. If they don't, someone else updated the record while you were doing your editing. As you can see, network applicatuons are *not* simple. -- Leonard Erickson leonard@qiclab.scn.rain.com CIS: [70465,203] 70465.203@compuserve.com FIDO: 1:105/51 Leonard.Erickson@f51.n105.z1.fidonet.org (The CIS & Fido addresses are preferred)
Technical Details
Message-ID:
<1992Aug12.021351.27355@qiclab.scn.rain.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!rpi!uwm.edu!ogicse!qiclab!leonardReferences:
<1992Aug7.130218.16504@mnemosyne.cs.du.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!rpi!uwm.edu!ogicse!qiclab!leonard From: leonard@qiclab.scn.rain.com (Leonard Erickson) Newsgroups: comp.os.msdos.programmer,alt.msdos.programmer Subject: Re: Writing a program to run on a Novell network Message-ID: <1992Aug12.021351.27355@qiclab.scn.rain.com> Date: 12 Aug 92 02:13:51 GMT Article-I.D.: qiclab.1992Aug12.021351.27355 References: <1992Aug7.130218.16504@mnemosyne.cs.du.edu> Reply-To: 70465.203@compuserve.com Organization: SCN Research/Qic Laboratories of Tigard, Oregon. Lines: 42