Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Networking /
Chapter 6 - AppleTalk Transaction Protocol (ATP) / ATP Reference
Routines / Responding to Requests


PSendResponse

The PSendResponse function sends the response message to the requester.

FUNCTION PSendResponse (thePBPtr: ATPPBPtr; async: Boolean): OSErr;
thePBPtr
A pointer to an ATP parameter block.
async
A Boolean that indicates whether the function should be executed asynchronously or synchronously. Specify TRUE for asynchronous execution.
-->ioCompletionProcPtrA pointer to a completion routine.
<--ioResultOSErrThe function result.
-->userDataLongIntFour bytes of user data.
-->csCodeIntegerAlways sendResponse for this function.
-->atpSocketByteThe socket number.
-->atpFlagsByteThe control information.
-->addrBlockAddrBlockThe destination socket address.
-->bdsPointerPtrA pointer to the response BDS.
-->numOfBuffsByteThe number of response packets to be sent.
-->bdsSizeByteThe BDS size in elements.
-->transIDIntegerThe transaction ID.

Field Description
userData
Four bytes of user data that are sent in the header of the message. If the response was part of an exactly-once transaction, this field contains the user bytes from the TRel packet.
atpSocket
The number of the socket that is sending the response.
atpFlags
A control information field whose bits, numbered 0-7, are used
as flags.
To signal that this packet is the last packet in the transaction's response message when the number of responses is less than expected, set the end-of-message (atpEOMvalue) bit (bit 4).
ATP sets the send-transmission-status (atpSTSvalue) bit (bit 3) to force the requester to retransmit a request immediately, when this
is necessary.
To direct ATP to use DDP's checksum feature, set the send checksum (atpSendChkvalue) bit (bit 0) of this flag.
addrBlock
The AppleTalk internet socket address of the socket to which the response is to be sent.
bdsPointer
A pointer to the response buffer data structure (BDS) that contains the response data.
numOfBuffs
The number of response packets to be sent.
bdsSize
The number of elements in the buffer data structure (BDS).
transID
The transaction ID of the request for which this response is meant.
DESCRIPTION
You call PSendResponse when you receive a request, and after you have created a response message. The PSendResponse function sends the data to the socket whose address you specify; this is the address of the requester socket. If you cannot or do not want to send the entire response at one time, you can call PSendResponse to send the first part of it, then call PAddResponse later to send the remainder of the response.

To signal the requester socket that you are sending fewer response packets than it expects to receive, you must set the end-of-message flag (bit 4) of the atpFlags parameter.

For each call to the PSendResponse function that is part of an exactly-once (XO) transaction, ATP maintains a timer, called the release timer. If the timer expires before
the transaction is completed, that is, before the socket receives the transaction release packet, ATP completes the PSendResponse function. Before AppleTalk Phase 2, the release timer was always set to 30 seconds. The PSendRequest or the PNSendRequest function can set the release timer for the responder to a different value. For more information about sending a response, see "Responding to Requests" beginning on page 6-16.

SPECIAL CONSIDERATIONS
During exactly-once transactions, PSendResponse doesn't complete until either a TRel packet is received from the socket that made the request or the retry count is exceeded.

ASSEMBLY-LANGUAGE INFORMATION
To execute the PSendResponse function from assembly language, call the _Control trap macro with a value of sendResponse in the csCode field of the parameter block. To execute this function from assembly language, you must also specify the .ATP driver reference number.

noErr0No error
badATPSkt-1099Bad responding socket
badBuffNum-1100Sequence number out of range
noRelErr-1101No release received
noDataArea-1104Too many outstanding ATP calls
RESULT CODES
SEE ALSO
See the chapter "Introduction to AppleTalk" in this book for a description of the AppleTalk internet socket address structure.

For a description of the possible release timer values that PSendRequest or PNSendRequest can set, see either the PSendRequest function on page 6-24
or the PNSendRequest function on page 6-27.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996