int smdc_tx_data(struct smdc_data_parms *datap)
typedef struct smdc_data_parms { tSMChannelId channel; /* in */ char *data; /* in */ tSM_INT max_length; /* in */ tSM_INT done_length; /* out */ } SMDC_DATA_PARMS;
Attempt to write data to a channel whose output half has been configured for a data commuications protocol. Less than the maximum will be written when either:
To permit maximum system throughput, this function refuses to write to a channel whose status has changed since it was last checked. This allows an application to avoid checking the status during bulk data transfer. The application only needs to check the status (using smdc_tx_status()) when a call to smdc_tx_data() returns with done_length equal to zero. If a status change occurs while writing data, done_length may indicate that some, but not all, of the data was written. In this case, the most convenient way for an application to react is often to note how much data has been sent, and to try to send more. Since the new attempt will indicate that no data was written, it means that the application does not need to have different cases to handle a status change at the beginning of the data buffer and a status change after a partial write.
See also the document Prosody Data Communcations Protocols and Encodings for details of behaviour specific to individual protocols and encodings.
0 if call completed successfully, otherwise a standard error such as:
This function is part of the Prosody data communications API.