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 Connectionless Transactionless Endpoints /


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 the udata->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 the opt.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 the udata.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
The OTRcvUData function returns information about the data read into the TUnitData structure.

The OTFlags variable, referenced by the flag parameter, indicates whether there is more data to be retrieved in this packet. If the buffer referenced by the udata->udata.buf field is not large enough to hold the current data unit, the endpoint provider fills the buffer and sets the flag parameter to T_MORE to indicate that you must call the OTRcvUData function again to receive additional data. Subsequent calls to the OTRcvUData 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 the T_MORE flag set.

If the endpoint is in asynchronous mode or is not blocking and data is not available, the OTRcvUData function fails with the kOTNoDataErr result. The endpoint provider uses the T_DATA event to notify the endpoint when data becomes available. You can use a notifier function or the OTLook function to retrieve the event. Once you get the T_DATA event, you should continue calling the OTRcvUData function until it returns the kOTNoDataErr result.

It is possible to receive a T_DATA event, but when you execute the OTRcvUData function, it returns with a kOTNoDataErr result. If this happens, you should continue as though you just finished reading all the data.

SPECIAL CONSIDERATIONS
The XTI_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 a T_DATA event. See "Option Management" for information on setting this option.

SEE ALSO
"AppleTalk Reference".

Table 4-4 .


Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 JAN 1998