OTRcvUData
Reads data sent by a client using a connectionless transactionless protocol.C INTERFACE
OSStatus OTRcvUData (EndpointRef ref, TUnitData* udata, OTFlags* flag);C++ INTERFACE
OSStatus TEndpoint::RcvUData(TUnitData* udata, OTFlags* flag);PARAMETERS
ref- The endpoint reference of the endpoint receiving the data.
udata- A pointer to a
TUnitDatastructure (page 3-55) that, on return, contains information about the data that has been received. See the description of theTUnitDatastructure for how to set this parameter when doing a no-copy receive.flags- A pointer to an unsigned long variable whose bit setting, on return, indicates whether you need to retrieve more data. A value of
T_MOREspecifies that there is more data; a value of 0 specifies that there is no more data.DESCRIPTION
When theOTRcvUDatafunction returns, it passes a pointer to aTUnitDatastructure containing information about the data read and a pointer to aflagsvariable that is set to indicate whether there is more data to be retrieved. If the buffer pointed to by theudata->udata.buffield is not large enough to hold the current data unit, the endpoint provider fills the buffer and sets theflagsparameter toT_MOREto indicate that you must call theOTRcvUDatafunction again to receive additional data. Subsequent calls to theOTRcvUDatafunction return 0 for the length of the address and option buffers until you receive the full data unit. The last unit to be received does not have theT_MOREflag set.If the endpoint is in asynchronous mode or is not blocking and data is not available, the
OTRcvUDatafunction fails with thekOTNoDataErrresult. The endpoint provider uses theT_DATAevent to notify the endpoint when data becomes available. You can use a notifier function or theOTLookfunction to retrieve the event. Once you get theT_DATAevent, you should continue calling theOTRcvUDatafunction until it returns thekOTNoDataErrresult.It is possible that the provider generates an erroneous
T_DATAevent. This is
the case when the provider calls your notifier, passingT_DATAfor thecodeparameter; but when you execute theOTRcvUDatafunction, it returns with akOTNoDataErrresult. If this happens, you should continue normal processing and assume that the nextT_DATAevent is genuine.SPECIAL CONSIDERATIONS
TheXTI_RCVLOWAToption allows endpoints that support it to negotiate the minimum number of bytes that must have accumulated in the endpoint's internal receive buffer before the endpoint provider generates aT_DATAevent. If the endpoint you are using supports this option, you can negotiate a value using theOTOptionManagementfunction. Because you use theOTOptionManagementfunction to set this option, it affects all subsequent sends.VALID STATES
T_IDLESEE ALSO
You can use theOTLookfunction (page 3-85) to retrieve pending asynchronous events for this endpoint.For a description of the
OTOptionManagementfunction, see the chapter "Option Management" in this book.For information on how to use this function with the AppleTalk DDP protocol, see page 12-11 in the DDP chapter.
You use the
TUnitDatastructure (page 3-55) to specify the size and location of buffers that contain information about the data that has been received.