Important: The information in this document is obsolete and should not be used for new development.
OTRcvUData
Reads data sent to 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
TUnitData
structure that, on return, contains information about the data that has been received.
- The
udata->addr.buf
field is a pointer to a buffer that is filled with the address of the endpoint that has sent the data. You must allocate this buffer and set theudata->addr.maxlen
field to the size of the buffer.
- The
udata->opt.buf
field is a pointer to a buffer that is filled with any association-related options specified by the endpoint sending data. To read these options, you must allocate a buffer into which the provider can place the options and you must set theopt.maxlen
field to the size of the buffer.
- The
udata->udata.buf
field is a pointer to a buffer in which the function stores data when it returns. You must allocate a buffer for the data and set theudata.maxlen
field to the size of the buffer.flag
- A pointer to an unsigned long variable whose bit setting, on return, indicates whether you need to retrieve more data. If the
T_MORE
is set, there is more data; if it is clear, there is no more data.
- function result
- An error code. See Discussion.
DISCUSSION
TheOTRcvUData
function returns information about the data read into theTUnitData
structure.The
OTFlags
variable, referenced by theflag
parameter, indicates whether there is more data to be retrieved in this packet. If the buffer referenced by theudata->udata.buf
field is not large enough to hold the current data unit, the endpoint provider fills the buffer and sets theflag
parameter toT_MORE
to indicate that you must call theOTRcvUData
function again to receive additional data. Subsequent calls to theOTRcvUData
function return 0 for the length of the address and option buffers until you receive the full data unit. The last part of the unit received does not have theT_MORE
flag set.If the endpoint is in asynchronous mode or is not blocking and data is not available, the
OTRcvUData
function fails with thekOTNoDataErr
result. The endpoint provider uses theT_DATA
event to notify the endpoint when data becomes available. You can use a notifier function or theOTLook
function to retrieve the event. Once you get theT_DATA
event, you should continue calling theOTRcvUData
function until it returns thekOTNoDataErr
result.It is possible to receive a
T_DATA
event, but when you execute theOTRcvUData
function, it returns with akOTNoDataErr
result. If this happens, you should continue as though you just finished reading all the data.SPECIAL CONSIDERATIONS
TheXTI_RCVLOWAT
option 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_DATA
event. See "Option Management" for information on setting this option.SEE ALSO
"AppleTalk Reference".