Important: The information in this document is obsolete and should not be used for new development.
OTRcvRequest
You use theOTRcvRequestfunction to read a request from a connection-oriented transaction-based requester.C INTERFACE
OSStatus OTRcvRequest(EndpointRef ref, TRequest* req, OTFlags* reqFlags);C++ INTERFACE
OSStatus TEndpoint::RcvRequest(TRequest* req, OTFlags* flags);PARAMETERS
ref- The endpoint reference of the endpoint reading the request.
req- A pointer to a
TRequeststructure that contains information, on return, about the incoming request. You must allocate buffers in which this information can be stored and specify the maximum size of each buffer.
- The
req->data.buffield is a pointer to a buffer in which the incoming request is stored. Set thereq->data.maxlenfield to the maximum size of the request.
- The
req->opt.buffield is a pointer to a buffer in which the options specified by the requester are stored. Set thereq->opt.maxlenfield to the maximum size of option data.
- The value for the
req->sequencefield is generated by the endpoint provider. You need to save this value and use it for thesequencefield when sending a reply.
reqFlags- A bitmapped 32-bit value specifying, on return, whether there is more request data coming (
T_MORE) and whether the provider is going to acknowledge replies (T_ACKNOWLEDGED).
- function result
- An error code. See Appendix B, and Discussion.
DISCUSSION
You use theOTRcvRequestfunction to read an incoming request. After reading the request, you can use theOTSndReplyfunction to reply to that request or theOTCancelRequestfunction to reject the request.When the
OTRcvRequestfunction returns, thereq->data.buffield points to the request data and thereq->sequencefield specifies a transaction ID for this transaction. You must use this same sequence value when calling theOTSndReplyfunction to reply to this request or theOTCancelRequestfunction to reject it.If the endpoint is in synchronous mode and is blocking, the
OTRcvRequestfunction returns only when a request arrives. TheOTRcvRequestfunction returns either the next unread request or thekOTNoDataErrresult if there are no pending requests.When a request arrives, the provider generates a
T_REQUESTevent. You can poll for this event using theOTLookfunction or call the function for as long as thekOTNoDataErrresult is returned. If you have a notifier installed for this endpoint, the event is sent to the notifier. For more information on notifier functions and event codes, seeMyNotifierCallbackfunction and "Event Codes".If you have allocated a buffer that is too small to hold the request data, the provider sets the
T_MOREbit in thereqFlagsfield to indicate that there is more request data to be read. You must call theOTRcvRequestfunction until theT_MOREflag is cleared in order to retrieve the rest of the request data. Thereq->opt.buffield contains no information for these additional calls.The flags parameter can also have the
T_PARTIALDATAbit set. In this case, the request data being received is only partial; there is more data coming, but it has not arrived. The difference betweenT_MOREandT_PARTIALDATAis that the first indicates that there is more data and the next call toOTRcvRequestwill read that data, while the second does not gurantee that the next read will get the data. TheT_PARTIALDATAbit is only set on the first call to the function. All subsequent calls toOTRcvRequestare guaranteed to continue reading the partial data in question until the function returns with theT_MOREflag clear.SEE ALSO
"AppleTalk Reference".