beautypg.com

Apple AppleShare 3.0 File Server Controls User Manual

Page 31

background image

been satisfied, you can use server events in conjunction with server control

calls to respond to the condition. For example, you can shut the server down,

disconnect a user, or send a message to any or all connected users as a

response to a server event.

Sample server event handler code

This section contains sample code that implements the server event mechanism

in a server addition. The sample includes all of the necessary parts; you

need only plug in your specific code segments to make it work. Comments

within the code explain the purpose of each part. You can copy as much of the

sample code as you want to use in your own server additions.

{ This unit contains the server event handler, the server }

{ event record processor, and related routines. }

UNIT ServerEventHandler;

{==========================================================}

INTERFACE

USES

AppleTalk, Processes,

{$IFC UNDEFINED THINK_Pascal}

Errors, Memory, Packages,

{$ENDC}

ServerControlIntf, ServerEventIntf;

CONST

{ This value indicates how many server events can be }

{ queued for ProcessServerEvents to handle later. }

{ If you expect a large number of server events to }

{ come in over a short amount of time, increase this }

{ number. }

kNumberServerEvents = 100;

TYPE

{ Add required queue element fields to a server event }

{ record so we can use it as an OS queue element. }

SERecQElemPtr = ^SERecQElem;

SERecQElem = RECORD