Thank you for the response. My program becomes non-responsive after a while (several hours) once the wait_for_transmission() function is called. Would a try/catch structure ensure that any errors/problems in calling wait_for_transmission() are trapped so my program doesn't hang? I already have a try/catch in place for yami_runtime_error, but not for yami_logic_error. Example code:
try
{
yami::parameters params;
uuid_generate( aUuid );
char lAux[ char_for_uuid ];
uuid_unparse( aUuid, lAux );
params.set_string( "Guid", lAux );
ConnectionClientEventCallbacks lCallbacks;
yami::agent lYamiClient( lCallbacks );
auto_ptr<yami::outgoing_message> config_om( lYamiClient.send( server_address, server_name, function_to_send, params) );
config_om->wait_for_transmission(); // After several hours of uninterrupted operation, this is were my program seems to hang. Perhaps a try/catch around this call?
// Check the state of config_om
if( true == sent )
{
yami::message_state lState = config_om->get_state();
if ( (yami::rejected == lState) || (yami::abandoned == lState))
{
cout << "function_to_send: ERROR" << endl;
lResult = false;
}
}
else
{
cout << "function_to_send timed out" << endl;
}
// Wait for the Server to send Results back
yami::parameters lRetValParams;
if( true == lResult )
{
lRetValParams = WaitForMessage( aUuid, 100, lResult);
}
// Process the Results (if any) and send them back to the client application
if( true == lResult )
{
}
}
// YAMI4 runtime errors (e.g. due to resource constraints or communication problems)
catch(const yami::yami_runtime_error & aYamiException)
{
//Push the YAMI
cout << "Yami runtime error in function_to_send): " << aYamiException.what() << endl;
stringstream lAux;
lAux << aYamiException.what() << " (runtime) in function_to_send";
throw yami::yami_runtime_error(lAux.str().c_str());
}
}
Many thanks