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
TReply
structure that specifies the reply data being sent, the transaction ID for this transaction, and any options you want to set.
- The
reply->data.buf
field is a pointer to the buffer containing the reply. Set thereply->data.len
field to the size of the reply. The size of the reply must not exceed the value specified for thetsdu
field of theTEndpointInfo
structure for this endpoint.
- The
reply->opt.buf
field is a pointer to the buffer that contains the options you want to set. Set thereply->opt.len
field to the size of the option data or to 0 if you don't want to specify any options.
- The
reply->sequence
field specifies the transaction ID of the request to which you are replying. (This value was returned in thereq->sequence
field by theOTRcvRequest
function.)
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_MORE
not set).
- function result
- An error code. See Appendix B, and Discussion.
DISCUSSION
You use theOTSndReply
function to reply to a request you have read using theOTRcvRequest
function . Thereply
parameter contains the reply to be sent, and thereplyFlags
parameter specifies whether you are sending the entire reply with this send (T_MORE
bit clear) or sending just part of the reply (T_MORE
bit set). If you are using multiple sends, you must set theT_MORE
bit on each but the last send. The total size of the data you send using multiple sends must not exceed the value of thetsdu
field of theTEndpointInfo
structure for this endpoint.If the endpoint is in synchronous blocking mode, the
OTSndReply
function returns after it has sent the reply. If the endpoint is in synchronous nonblocking mode, theOTSndReply
function returns thekOTFlowErr
result if the endpoint provider is unable to send the reply because of flow-control restrictions. The provider issues theT_GODATA
event 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
OTSndReply
function completes. Thecode
parameter of the notifier function contains theT_REPLYCOMPLETE
event, thecookie
parameter contains thereply
parameter passed with theOTSndReply
function, and theresult
parameter contains the function result. For more information on notifier functions and event codes, seeMyNotifierCallback
function and "Event Codes".If the reply was not sent successfully (that is, timed out--for acknowledged requests), the
kETIMEDOUTErr
result code is returned. For unacknowledged requests, theT_REPLYCOMPLETE
event is still generated for asynchronous clients so that the logic is the same for both acknowledged and unacknowledged requests.The
cookie
parameter passed to the notifier is set to thereply
parameter of the original request. In cases where theT_MORE
flag 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
OTSndReply
function.
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 kOTFlowErr
result is never returned.The kOTFlowErr
result might be returned.Asynchronous The function returns immediately. The provider calls your notifier, passing
T_REPLYCOMPLETE
for thecode
parameter when the reply is successfully sent or timed out.The function returns immediately. The provider calls your notifier, passing
T_REPLYCOMPLETE
for thecode
parameter when the reply is successfully sent or timed out.The kOTFlowErr
result might be returned.The kOTFlowErr
result might be returned.SEE ALSO
TheOTRcvReply
function.