Important: The information in this document is obsolete and should not be used for new development.
OTSndReply
Replies to a connection-oriented transaction-based request.C INTERFACE
OSStatus OTSndReply(EndpointRef ref, TReply* reply, OTFlags replyFlags);C++ INTERFACE
OSStatus TEndpoint::SndReply(TReply* reply, OTFlags replyFlags );PARAMETERS
ref- The endpoint reference of the endpoint reading the request.
reply- A pointer to a
TReplystructure that specifies the reply data being sent, the transaction ID for this transaction, and any options you want to set.
- The
reply->data.buffield is a pointer to the buffer containing the reply. Set thereply->data.lenfield to the size of the reply. The size of the reply must not exceed the value specified for thetsdufield of theTEndpointInfostructure for this endpoint.
- The
reply->opt.buffield is a pointer to the buffer that contains the options you want to set. Set thereply->opt.lenfield to the size of the option data or to 0 if you don't want to specify any options.
- The
reply->sequencefield specifies the transaction ID of the request to which you are replying. (This value was returned in thereq->sequencefield by theOTRcvRequestfunction.)
replyFlags- A bitmapped 32-bit value specifying whether the rest of the reply is being sent with a subsequent call to this function (
T_MORE) or whether this is the complete reply (T_MOREnot set).
- function result
- An error code. See Appendix B, and Discussion.
DISCUSSION
You use theOTSndReplyfunction to reply to a request you have read using theOTRcvRequestfunction . Thereplyparameter contains the reply to be sent, and thereplyFlagsparameter specifies whether you are sending the entire reply with this send (T_MOREbit clear) or sending just part of the reply (T_MOREbit set). If you are using multiple sends, you must set theT_MOREbit on each but the last send. The total size of the data you send using multiple sends must not exceed the value of thetsdufield of theTEndpointInfostructure for this endpoint.If the endpoint is in synchronous blocking mode, the
OTSndReplyfunction returns after it has sent the reply. If the endpoint is in synchronous nonblocking mode, theOTSndReplyfunction returns thekOTFlowErrresult if the endpoint provider is unable to send the reply because of flow-control restrictions. The provider issues theT_GODATAevent when these restrictions are lifted. You can use the OTLook function> to poll for this event, or you can use your notifier to handle it.If the endpoint is in asynchronous mode, the provider calls your notifier when the
OTSndReplyfunction completes. Thecodeparameter of the notifier function contains theT_REPLYCOMPLETEevent, thecookieparameter contains thereplyparameter passed with theOTSndReplyfunction, and theresultparameter contains the function result. For more information on notifier functions and event codes, seeMyNotifierCallbackfunction and "Event Codes".If the reply was not sent successfully (that is, timed out--for acknowledged requests), the
kETIMEDOUTErrresult code is returned. For unacknowledged requests, theT_REPLYCOMPLETEevent is still generated for asynchronous clients so that the logic is the same for both acknowledged and unacknowledged requests.The
cookieparameter passed to the notifier is set to thereplyparameter of the original request. In cases where theT_MOREflag is used to send the reply in muliple chunks, the firstTReply*is used.The next table shows how the endpoint's mode of execution and blocking status affects the behavior of the
OTSndReplyfunction.
Blocking Nonblocking Synchronous The function returns when the provider lifts flow-control restrictions and the reply has been successfully sent or timed out. The function returns if flow-control restrictions are in effect or when the reply has been successfully sent or timed out. The kOTFlowErrresult is never returned.The kOTFlowErrresult might be returned.Asynchronous The function returns immediately. The provider calls your notifier, passing
T_REPLYCOMPLETEfor thecodeparameter when the reply is successfully sent or timed out.The function returns immediately. The provider calls your notifier, passing
T_REPLYCOMPLETEfor thecodeparameter when the reply is successfully sent or timed out.The kOTFlowErrresult might be returned.The kOTFlowErrresult might be returned.SEE ALSO
TheOTRcvReplyfunction.
 
  
  
  