lrt_tpsend

Communication Functions

Sends a message in a conversational connection.

int lrt_tpsend( int cd, char *data, long len, long flags, long *revent );

cd Call descriptor specifying the open connection.
data Message data.
len Length of the data.
flags Valid flags: TPRECVONLY - caller wants only to receive data, TPNBLOCK - request not sent if blocking condition exists, TPNOTIME - caller immune to blocking timeouts, TPSIGRSTRT - any interrupted system calls are re-issued after lrt_tpsend.
revent If an event exists for the call descriptor, lrt_tpsend will fail without sending data, and the event type is returned in revent.

The lrt_tpsend function sends a message across an open connection to another program. The caller must have control of the connection. It is used in conjunction with lrt_tprecv. This function can print debugging information in brief mode.

Return Values

If the function fails or an event exists, it returns -1 and sets tperrno to indicate the error condition or event.

Parameterization

You cannot use standard parameterization for any arguments in this function.

Example

In the following example, the lrt_tpsend function sends a message over the open connection, cd.

Copy code
char* data_0;
char* data_1;
int cd;
lrt_tpconnect("AUDITC", NULL, 0, TPSENDONLY);
data_0 = lrt_tpalloc("STRING", "", 80);
lrt_strcpy(data_0, "t"); // get teller balances for bank app
data_1 = lrt_tpalloc("STRING", "", 1024);
lrt_tpsend(cd,data_0,0,TPRECVONLY,&revent);
lrt_tprecv(cd,&data_1,&olen,TPNOCHANGE,&revent);
lrt_strcpy(data_0, "a"); // get account balances for bank app
lrt_tpsend(cd,data_0,0,TPRECVONLY,&revent);
lrt_tprecv(cd,&data_1,&olen,TPNOCHANGE,&revent);
lrt_tpdiscon(cd);                                    
// take down conversational client connection
// can't call lrt_tpsend or lrt_tprecv on this connection any more.