PPCReadSync
PPCRead
Read incoming data from an application PPCReadPBPtr pb; Pointer to PPC parameter block
Boolean async; if TRUE, use asynchronous communications On entry A0: pointer to a parameter block
D0: selector (7)
On exit D0: result code
Parameter block
Æ 12 ioCompletion long address of a completion routine
Æ 40 sessRefNum long session reference number
Æ 44 bufferLength long length of data buffer
¨ 48 actualLength long actual length of data read
Æ 52 bufferPtr long pointer to data buffer
¨ 56 more char TRUE if more data in this block to be read ¨ 58 userData long application-specific data
¨ 62 blockCreator long creator of block read
¨ 66 blockType long type of block read
The PPCRead function reads incoming data from an application, and the PPCWrite function writes data to an application during a session. Use the PPCRead function to read message blocks during a session. If your application calls this function asynchronously, you must specify in
the ioCompletion field either the address of a completion routine or NIL. If
ioCompletion is NIL, you should poll the ioResult field of the
PPC parameter block (from your application's main event loop) to determine
whether the PPC Toolbox has completed the requested operation. A value in the ioResult field other than 1 indicates that the call is complete. Note that it is
unsafe to poll the ioResult field at interrupt time since the PPC Toolbox may be in the process of completing a call.
If you call the PPCRead function asynchronously, you must not change any of the fields in the parameter block until the call completes. The buffer pointed to
PPC Toolbox until the call completes. These objects must not be de allocated or moved in memory while the call is in progress.
The sessRefNum field specifies a session to read data from. This must be a
valid session reference number returned from a previous PPCStart, bufferPtr fields specify the length and location of a buffer the
message block will be read into. Your application must allocate the storage for
the buffer. The actualLength field returns the actual size of the data read into
your data buffer.
The more field is TRUE if the provided buffer cannot hold the remainder of the message block. Your application may read a message block in several pieces. It
is not necessary to have a buffer large enough to read in the entire
message block, so a message block can span multiple calls to the PPCRead function.
Upon completion of the PPCRead function, the userData, blockCreator, and blockType fields contain information regarding the contents of the
message block. You specify these fields using the PPCWrite function. You should execute the PPCRead function asynchronously. noErr (0) No error
notInitErr (-900) PPC Toolbox has not been initialized yet noGlobalsErr (-904) System unable to allocate memory, critical error
noSessionErr (-908) Invalid session reference number
badReqErr (-909) Invalid state for this operation
sessClosedErr (-917) The session has closed