Important: The information in this document is obsolete and should not be used for new development.
OTSndUReply
Replies to a request sent by a client using a connectionless transaction-based protocol.C INTERFACE
OSStatus OTSndUReply(EndpointRef ref, TUnitReply* reply, OTFlags replyFlags);C++ INTERFACE
OSStatus TEndpoint::SndUReply(TUnitReply* reply, OTFlags replyFlags);PARAMETERS
ref- The endpoint reference of the endpoint sending the reply.
reply
- A pointer to a
TUnitReplystructure that specifies information about the requester, options, the ID of this transaction, and the reply data.
- The
reply->addrfield specifies the location and size of a buffer containing the address of the requester. You are not required to provide this information. If you do not want to provide address information, set thereply->addr.lenfield to 0. To specify an address, you must allocate a buffer for the address and initialize it to the destination address. Then you set thereply->addr.buffield to point to the buffer and set thereply->addr.lenfield to the length of the address.
- The
reply->optfield specifies the location and size of a buffer containing the options that you set for this reply. You must set thereply->opt.lenfield to the length of the options or to 0 if you don't want to specify any options.
- The
reply->udatafield specifies the location and size of a buffer containing the reply data sent to the requester. You allocate a buffer that contains the reply data, set thereply->udata.buffield to point to that buffer, and set thereply-> udata.lenfield to specify the size of the reply. The size cannot exceed the value specified for thetsdufield of theTEndpointInfostructure for the endpoint.
- Set the
reply->sequencefield to the value that you read for this field with theOTRcvURequestfunction.
replyFlags- A bitmapped 32-bit value, which you can set to
T_MOREto indicate that you are sending more reply data with a subsequent call to theOTSndUReplyfunction.
- function result
- An error code. See Discussion.
DISCUSSION
You use theOTSndUReplyfunction to send a reply. TheTUnitReplystructure that you pass in thereplyparameter specifies the address of the requester, the reply data, any options you want to specify for this reply, and a transaction ID. If you do not specify the requester's address, the endpoint provider uses the transaction ID value stored in thesequencefield of thereplyparameter to match the reply against a pending request and knows in this way where to send the request.If requests are acknowledged and you do not receive an acknowledgement from the other side within a specific amount of time (usually negotiated with the
ATP_OPT_RELTIMERoption), the function returns with thekETIMEDOUTErrresult. If requests are not acknowledged, the function returns immediately, and you have no way of knowing whether the reply was received and read.If requests are not acknowledged, the provider generates a
T_REPLYCOMPLETEevent code for asynchronous responders even if the requester has not acknowledged receipt of the reply. Thus, the only way for you to know whether this event actually means that the reply was received, is to examine thereqFlagsfield of thereqparameter for theOTRcvURequestfunction. If theT_ACKNOWLEDGEDflag is set, then theT_REPLYCOMPLETEevent indicates that your reply was received. Thecookieparameter passed to the notifier to indicate completion is set to thereplyparameter.The following table shows how the endpoint's mode of execution and blocking status affects the behavior of the
OTSndUReplyfunction.
Blocking Nonblocking Synchronous The function returns when the provider lifts flow-control restrictions and the reply has been acknowledged or timed out (if the matching request was an acknowledged request). The function returns immediately. 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 acknowledged or timed out.The function returns immediately. The provider calls your notifier, passing
T_REPLYCOMPLETEfor thecodeparameter when the reply is acknowledged or timed out.The kOTFlowErrresult might be returned.The kOTFlowErrresult might be returned.SEE ALSO
TheOTCancelUReplyfunction.