Important: The information in this document is obsolete and should not be used for new development.
Getting the Name of Your Application's Zone
Your application can get the name of the zone for the node on which it is running by calling theGetMyZonefunction. The zone name is a data structure of typeStr32,
and theGetMyZone function writes the zone name to a buffer that you supply. You
set the parameter block'szipBuffPtrfield to a pointer for a buffer that must be at
least 33 bytes in size.You also supply a buffer that is 70 bytes in size as the value of the
zipInfoField. You must set the first word of this buffer to 0 before you call the function. This buffer is for ZIP to use.Listing 4-1 shows the application-defined
DoGetMyZonefunction, which illustrates the use of theGetMyZonefunction. TheDoGetMyZonefunction declares the parameter block and the return buffer. Then it assigns values to the some of parameter block fields and initializes to 0 the first word of thezipInfoFieldparameter before it callsGetMyZone. The MPW interface fills in the XPP parameter blockioRefNum,csCode, andxppSubCodefields, so theDoGetMyZonefunction doesn't need to assign these values.Listing 4-1 Using the
GetMyZonefunction
FUNCTION DoGetMyZone(VAR myZoneName: Str32): OSErr; VAR xppPB: XPPParamBlock; myZoneName: ARRAY[1..33] OF Char; BEGIN WITH xppPB DO BEGIN xppTimeout := 3; {timeout interval} xppRetry := 4; {retry count for ZIP requests} zipBuffPtr := @myZoneName; {buffer for returned zone name} zipInfoField[1] := 0; {initialize first word to 0} zipInfoField[2] := 0; END; DoGetMyZone := GetMyZone(@xppPB, FALSE); END;If there is no router present in the network, the function returns a function result ofnoBridgeErr. If the retry count is exceeded before the ATP transaction that ZIP relies on receives a valid response, the function returns a function result ofreqFailed. The function returns a function result oftooManyReqwhen too many concurrent ATP requests have been made. If you receive a function result oftooManyReq, wait a minute or so, and then try again; some transactions can take up to 30 seconds to complete. For the complete list of function results, see the description of the functionGetMyZonebeginning on page 4-12.