Technote NW 10 | November 1987-March 1988 |
Changes since March 1988: Added note that AppleShare version 3.0 and Macintosh file sharing don't support AppleShare foreground applications. Added additional notes about AppleShare foreground applications.
An AppleShare server requires a dedicated Macintosh. The server, however, is implemented as an interrupt-driven application that runs in the system heap of the server machine. This allows the running of a concurrent or foreground application that will live in the application heap of the server machine. An example of a foreground application is LaserShare, the LaserWriter spooler available from Apple.
An AppleShare foreground application has a few additional restrictions and requirements beyond that of a normal Macintosh application:
1. In order for AppleShare to recognize your program as a foreground application, it must contain a resource of type 'fgnd', ID=1, containing a longword of $00000000.
2. Do not make any file system calls outside of server volumes' Server Folders. If a foreground application needs to create files, it is recommended that the application create a folder inside the Server Folder and then create all its files within that folder. For example, all print spooler or E-mail files must reside within the Server Folder, and preferably, within a folder that is inside the Server Folder. To find the Server Folder,
* Make a PBHGetVlnfo call on the volume.
* Examine ioVFndrInfo[8] (long integer).
* If ioVFndrInfo[8] is nonzero, it is the directory ID of the Server Folder.
3. Do not make file system calls or in any way modify the AppleShare server application, the Parallel Directory Structure, or the user or group databases within the Server Folder of any volume. Also, do not rely on the presence or formats of these structures, as they are subject to change!
4. Do not eject or unmount a volume that is not in drive 1 or 2.
5. Do not call the Shutdown trap; instead, quit by calling ExitToShell or by dropping out of the main event loop.
In addition to these restrictions, here are a few other things that are good to know when writing an AppleShare foreground application.
Although you can install multiple AppleShare foreground applications on an AppleShare server, only one can be active at a time. Since the AppleShare Admin application is an AppleShare foreground application, users will have to quit Admin to run your application and quit your application to run Admin.
Any files opened by an AppleShare foreground application count toward the maximum number of open files allowed on the AppleShare file server. See Macintosh Technical Note #216, "AppleShare and File-Sharing Limits," for the number of open files allowed on a particular AppleShare file server.
Foreground applications are launched by an AppleShare file server, so AppleShare decides how big your application heap will be. First AppleShare reads your 'SIZE' resource. It uses ID 0 (the Finder-created 'SIZE' resource) if it is available. It uses ID -1 (the default 'SIZE' resource created by the programmer) if ID 0 isn't available. It uses any other 'SIZE' resource it can find if IDs 0 and-1 aren't there. If no 'SIZE' resources are found, then AppleShare uses 196 KB for the size and the minimum size. If your application has a 'SIZE' less than 128 KB, then 128 KB is used for the size and the minimum size.
AppleShare then attempts to allocate the minimum size for your application (as found above). If successful, AppleShare sets the system cache to 32 KB (the minimum). (At this point, your application could still be launched if any of the following things fail.) Then, AppleShare attempts to allocate the default size for your application (as found above). After that, AppleShare gives any remaining memory back to the system cache.
Further Reference: