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 /


OTSndUData

Sends data using a connectionless transactionless endpoint.

C INTERFACE
OSStatus OTSndUData(EndpointRef ref,
                     TUnitData* udata);
C++ INTERFACE
OSStatus TEndpoint::SndUData(TUnitData* udata);
PARAMETERS
ref
The endpoint reference of the endpoint sending the data.

udata
A pointer to a TUnitData structure that specifies the data to be sent, its destination, and any options for this send.

The udata->addr.buf field is a pointer to a buffer that contains the address to which the data is sent. You must initialize the buffer, and set the udata->addr.len field to the size of the address.

The udata->opt.buf field is a pointer to a buffer that contains option information. Store option information in the buffer and set the udata->opt.len field to the size of the options. If you do not want to specify any options, set this field to 0.

The udata->udata.buf field is a pointer to a buffer that contains data to be sent. Set the udata->udata.len field to the size of the data.

function result
An error code. See Discussion.
DISCUSSION
The OTSndUData function sends data to the address specified by the udata->addr field of the udata parameter. If the endpoint does not support sending 0 bytes or if the amount of data exceeds the TSDU size for the endpoint, the function returns with the result kOTBadDataErr.

If the endpoint is in synchronous blocking mode, the OTSndUData function returns when the send is complete. If flow-control restrictions prevent its sending the data, it retries the operation until it is able to send it.

If the endpoint is in nonblocking or asynchronous mode, the OTSndUData function returns a kOTFlowErr result if flow-control restrictions prevent the data from being sent. When the endpoint provider is able to send the data, it sends your notifier function, a T_GODATA event. You can then call the OTSndUData function from your notifier to send the data. You can also retrieve this event by polling the endpoint using the OTLook function.

The next table shows how the endpoint's modes of operation and blocking status affects the behavior of the OTSndUData function.

 BlockingNonblocking
SynchronousThe function returns when the provider lifts flow-control restrictions.The function returns immediately.
 The kOTFlowErr result is never returned.The kOTFlowErr result might be returned.
Asynchronous  The function returns immediately.The function returns immediately.
 The kOTFlowErr result might be returned.The kOTFlowErr result might be returned.

SPECIAL CONSIDERATIONS
Some endpoint providers are not able to detect immediately whether you specified incorrect address or option information. Because of this, the provider calls your notifier function when it detects the error, passing the T_UDERR event code for the code parameter to advise you that an error has occurred. You can determine the cause of this event by calling the OTRcvUDErr function and examining the value of the uderr->error parameter. It is important that you call the OTRcvUDErr function even if you are not interested in examining the cause of the error. Failing to do this leaves the endpoint in a state where it cannot do other sends, nor deallocate memory reserved for internal buffers associated with the send.

The XTI_SNDLOWAT option allows endpoints that support it to negotiate the minimum number of bytes that must have accumulated in the endpoint's internal send buffer before they are sent. See "Option Management" for information on setting this option.

SEE ALSO
The OTRcvUData function.

"AppleTalk Reference".

Table 4-4.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 JAN 1998