Important: The information in this document is obsolete and should not be used for new development.
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 theudata->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 theudata->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 theudata->udata.len
field to the size of the data.
- function result
- An error code. See Discussion.
DISCUSSION
TheOTSndUData
function sends data to the address specified by theudata->addr
field of theudata
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 resultkOTBadDataErr
.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 akOTFlowErr
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, aT_GODATA
event. You can then call theOTSndUData
function from your notifier to send the data. You can also retrieve this event by polling the endpoint using theOTLook
function.The next table shows how the endpoint's modes of operation and blocking status affects the behavior of the
OTSndUData
function.
Blocking Nonblocking Synchronous The 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 theT_UDERR
event code for thecode
parameter to advise you that an error has occurred. You can determine the cause of this event by calling theOTRcvUDErr
function and examining the value of theuderr->error
parameter. It is important that you call theOTRcvUDErr
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
TheOTRcvUData
function.