Send a Tabular Data Stream (TDS) packet to a server.
CS_RETCODE ct_sendpassthru (cmd, sendptr) CS_COMMAND *cmd; CS_VOID *sendptr;
A pointer to a CS_COMMAND structure.
A pointer to a buffer containing the TDS packet to be sent to the server.
ct_sendpassthru returns the following values:
Return value |
Meaning |
---|---|
CS_PASSTHRU_MORE |
Packet sent successfully; more packets are available. |
CS_PASSTHRU_EOM |
Packet sent successfully; no more packets are available. |
CS_FAIL |
The routine failed. |
CS_CANCELLED |
The routine was cancelled. |
CS_PENDING |
Asynchronous network I/O is in effect.See “Asynchronous programming”. |
CS_BUSY |
An asynchronous operation is already pending for this connection. See “Asynchronous programming”. |
TDS is a communications protocol used for the transfer of requests and request results between clients and servers. Under ordinary circumstances, non-gateway applications do not have to deal with TDS, because Client-Library manages the data stream.
ct_recvpassthru and ct_sendpassthru are useful in gateway applications. When an application serves as the intermediary between two parties (such as a client and a remote server, or two servers), it can use these routines to pass the TDS stream from one server to the other, eliminating the process of interpreting the information and re-encoding it.
ct_sendpassthru sends a packet of bytes from the *sendptr buffer. Most commonly, sendptr will be *recvptr as returned by srv_recvpassthru. sendptr can also be the address of a user-allocated buffer containing the packet to send.
Default packet sizes vary by platform. On most platforms, a packet has a default size of 512 bytes. A connection can change its packet size through ct_con_props.
ct_sendpassthru returns CS_PASSTHRU_EOM if the TDS packet in the buffer is marked EOM (End Of Message). If the TDS packet is not marked EOM, ct_sendpassthru returns CS_PASSTHRU_MORE.
A connection which is being used for a passthrough operation cannot be used for any other Client-Library function until CS_PASSTHRU_EOM has been received.