lrt_tpconnect
| Communication Functions |
Establishes a conversational service connection.
int lrt_tpconnect( char *svc, char *data, long len, long flags );
| svc | Conversational service name. Must be one of the names posted by the conversational server. |
| data | Pointer to a buffer containing application-defined data to send to the listening program. |
| len | Length of the data. |
| flags | Valid flags: TPNOTRAN- SVC will not be performed on behalf of caller's transaction, TPSENDONLY - caller wants only to send data, TPRECVONLY - caller wants only to receive data, TPNOBLOCK - request not sent if blocking condition exists, TPNOTIME - caller immune to blocking timeouts, TPSIGRSTRT - any interrupted system calls are re-issued after lrt_tpconnect. |
The lrt_tpconnect function establishes a half-duplex conversational service connection.
Return Values
If the function succeeds, it returns a descriptor that is used for referring to the connection in subsequent calls. Otherwise, it returns -1 and sets tperrno to indicate the error condition.
Parameterization
The following argument(s) can be parameterized using standard parameterization: svc
Example
In the following example, the lrt_tpconnect function establishes a conversational service connection, cd.
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.

