lrt_tprecv
| Communication Functions |
Receives a message in a conversational connection.
int lrt_tprecv( int cd, char **data, long *len, long flags, long *revent );
| cd | Specifies on which open connection to receive data. |
| data | Address of the message data. |
| len | Length of the data. |
| flags | Valid flags: TPNOCHANGE - buffer type of reply data is not allowed to change, TPNBLOCK - request not sent if blocking condition exists, TPNOTIME - caller immune to blocking timeouts, TPSIGRSTRT - any interrupted system calls are re-issued after lrt_tprecv. |
| revent | Receive event type (if an event exists for the descriptor). |
The lrt_tprecv function receives data sent from another program across an open connection. It is used in conjunction with lrt_tpsend and can be issued only by a program that does not have control of the connection. This function can print debugging information in brief mode.
Return Values
If the function succeeds, it returns an event pointer and sets either TPEV_SVCSUCC or TPEV_SVCFAIL. If the function fails, it returns -1 and sets the error code in tperrno.
Parameterization
You cannot use standard parameterization for any arguments in this function.
Example
In the following example, the lrt_tprecv function instructs the Vuser to receive data from the open 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.

