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 With Open Transport / Part 2 - Open Transport Reference
Chapter 22 - Endpoints Reference / Functions
Functions for Connection-Oriented Transaction-Based Endpoints /


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 the reply->data.len field to the size of the reply. The size of the reply must not exceed the value specified for the tsdu field of the TEndpointInfo structure for this endpoint.

The reply->opt.buf field is a pointer to the buffer that contains the options you want to set. Set the reply->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 the req->sequence field by the OTRcvRequest 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 the OTSndReply function to reply to a request you have read using the OTRcvRequest function . The reply parameter contains the reply to be sent, and the replyFlags 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 the T_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 the tsdu field of the TEndpointInfo 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, the OTSndReply function returns the kOTFlowErr result if the endpoint provider is unable to send the reply because of flow-control restrictions. The provider issues the T_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. The code parameter of the notifier function contains the T_REPLYCOMPLETE event, the cookie parameter contains the reply parameter passed with the OTSndReply function, and the result parameter contains the function result. For more information on notifier functions and event codes, see MyNotifierCallback 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, the T_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 the reply parameter of the original request. In cases where the T_MORE flag is used to send the reply in muliple chunks, the first TReply* is used.

The next table shows how the endpoint's mode of execution and blocking status affects the behavior of the OTSndReply function.

 BlockingNonblocking
SynchronousThe 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 the code parameter when the reply is successfully sent or timed out.

The function returns immediately.

The provider calls your notifier, passing T_REPLYCOMPLETE for the code parameter when the reply is successfully sent or timed out.

 The kOTFlowErr result might be returned.The kOTFlowErr result might be returned.

SEE ALSO
The OTRcvReply function.

"AppleTalk Reference".

Table 4-4.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 JAN 1998