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
TUnitDatastructure (page 3-55) that specifies the data to be sent and its destination.DESCRIPTION
If the endpoint is in synchronous, blocking mode, theOTSndUDatafunction returns immediately. 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 mode, theOTSndUDatafunction returns akOTFlowErrresult if flow-control restrictions prevent the data from being sent. When the endpoint provider is able to send the data, it calls your notifier function, passingT_GODATAfor thecodeparameter. You can then call theOTSndUDatafunction from your notifier to send the data. You can also retrieve this event by polling the endpoint using theOTLookfunction.Some endpoint providers are not able to detect immediately whether you specified incorrect address or option information. In such cases, the provider calls your notifier function when it detects the error, passing the
T_UDERRfor thecodeparameter to advise you that an error has occurred. You can determine the cause of this event by calling theOTRcvUDErrfunction and examining the value of theuderr->errorparameter. It is important that you call theOTRcvUDErrfunction even if you are not interested in examining the cause of the error. Failing to do this leaves the endpoint in an invalid state for doing other sends and makes the endpoint provider unable to deallocate memory reserved for internal buffers associated with the send.The next table shows how the endpoint's mode of execution and blocking status affects the behavior of the
OTSndUDatafunction.
Blocking Nonblocking Synchronous The function returns when the provider lifts flow-
control restrictions.The function returns immediately. The kOTFlowErrresult is never returned.The kOTFlowErrresult might be returned.Asynchronous The function returns immediately The function returns immediately The kOTFlowErrresult is never returned.The kOTFlowErrresult might be returned.SPECIAL CONSIDERATIONS
TheXTI_SLOWAToption 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. 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
To read the data, the endpoint to which the data is sent uses theOTRcvUDatafunction, (page 3-105).You use the
TUnitDatastructure (page 3-55) to specify the data to be sent and its destination.You use the
OTDatastructure (page 3-52) to transfer noncontiguous data.You use the
OTOptionManagementfunction, described in the reference section of the chapter "Option Management" in this book to negotiate a value for theXTI_SNDLOWAToption.You use the
OTRcvUDErrfunction (described next) to retrieve information about the cause of aT_UDERRevent.For information on how to use this function with a TCP/IP protocol, see page 8-18 in the TCP/IP chapter.
For information on how to use this function with the AppleTalk DDP protocol, see page 12-11 in the DDP chapter.
You use the
OTLookfunction (page 3-85) to retrieve pending asynchronous events for an endpoint.