Important: The information in this document is obsolete and should not be used for new development.
PSendResponse
ThePSendResponsefunction 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
TRUEfor asynchronous execution.
--> ioCompletion ProcPtr A pointer to a completion routine. <-- ioResult OSErr The function result. --> userData LongInt Four bytes of user data. --> csCode Integer Always sendResponsefor this function.--> atpSocket Byte The socket number. --> atpFlags Byte The control information. --> addrBlock AddrBlock The destination socket address. --> bdsPointer Ptr A pointer to the response BDS. --> numOfBuffs Byte The number of response packets to be sent. --> bdsSize Byte The BDS size in elements. --> transID Integer The 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
TRelpacket.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 callPSendResponsewhen you receive a request, and after you have created a response message. ThePSendResponsefunction 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 callPSendResponseto send the first part of it, then callPAddResponselater 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
atpFlagsparameter.For each call to the
PSendResponsefunction 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 thePSendResponsefunction. Before AppleTalk Phase 2, the release timer was always set to 30 seconds. ThePSendRequestor thePNSendRequestfunction 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,PSendResponsedoesn't complete until either aTRelpacket is received from the socket that made the request or the retry count is exceeded.ASSEMBLY-LANGUAGE INFORMATION
To execute thePSendResponsefunction from assembly language, call the_Controltrap macro with a value of sendResponsein thecsCodefield of the parameter block. To execute this function from assembly language, you must also specify the .ATP driver reference number.
RESULT CODES
noErr 0 No error badATPSkt -1099 Bad responding socket badBuffNum -1100 Sequence number out of range noRelErr -1101 No release received noDataArea -1104 Too many outstanding ATP calls 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
PSendRequestorPNSendRequestcan set, see either thePSendRequestfunction on page 6-24
or thePNSendRequestfunction on page 6-27.