lrt_tpgetrply

Communication Functions

Returns a reply from a previously sent request.

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

cd Call descriptor for the request.
data Reply data.
len Length of received data.
flags Valid flags: TPGETANY - ignore cd and return any available reply, 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_tpgetrply.

The lrt_tpgetrply function returns a reply from a previously sent request.

Return Values

If the function succeeds, it returns a reply. If the function ends with an error, 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_tpgetrply function returns a reply from the service request to allocate a new buffer for a string.

vuser_init()

Copy code
{
char* data_0;
char* data_1;
long buflen;
int cd;
char string[] = "This is a string.";
data_0 = lrt_tpalloc("STRING", "", sizeof(string));
// Send a request, but cancel it afterwards
lrt_strcpy(data_0, string);
cd = lrt_tpacall("TOUPPER", data_0, 0, 0);
lrt_tpcancel(cd);
// Send a request, and look at reply
data_1 = lrt_tpalloc("STRING", "", 1024);
lrt_tpgetrply(&cd, &data_1, &olen, 0);
buflen = lrt_tptypes(data_1, type, NULL);
lr_output_message("The reply buffer type is %s, size is %lu.", type, buflen);
    return 0;