int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { try { // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); if (parse_args (argc, argv) != 0) return 1; CORBA::Object_var obj = orb->resolve_initial_references("Test"); ACE_ASSERT (!CORBA::is_nil(obj.in())); Test_var test = Test::_narrow( obj.in() ); ACE_ASSERT (!CORBA::is_nil(test.in())); CORBA::Short n = test->get_server_num (); ACE_DEBUG ((LM_DEBUG, "Client received reply from server %d\n", n)); if (expect_transient) return -1; return 0; } catch(const CORBA::TRANSIENT& ex) { if (expect_transient) return 0; ex._tao_print_exception ("client:"); } catch(const CORBA::Exception& ex) { ex._tao_print_exception ("client:"); } return -1; }
int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { try { CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); if (parse_args (argc, argv) != 0) return 1; ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t|%T) Client %d sending request to %C\n"), client_num, server_ior)); try { CORBA::Object_var obj = orb->string_to_object (server_ior); ACE_ASSERT (!CORBA::is_nil (obj.in ())); Test_var test = Test::_narrow (obj.in()); ACE_ASSERT (!CORBA::is_nil (test.in())); CORBA::Short n = test->get_server_num (); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t|%T) Client %d received reply from server %d\n"), client_num, n)); } catch (CORBA::TRANSIENT &) { if (expect_transient) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t|%T) Client %d got expected transient exception\n"), client_num)); } else { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t|%T) Client %d caught unexpected transent\n"), client_num)); return -1; } } return 0; } catch(const CORBA::Exception& ex) { ex._tao_print_exception (ACE_TEXT ("client:")); } return -1; }
int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) { try { // Initialize orb CORBA::ORB_var orb = CORBA::ORB_init( argc, argv ); if (parse_args (argc, argv) != 0) return 1; CORBA::Object_var obj = orb->resolve_initial_references("Test"); Test_var test; try { test = Test::_narrow( obj.in() ); if (killit) { test->terminate (); } else { CORBA::Short n = test->get_server_num (); ACE_DEBUG ((LM_DEBUG, "Client received reply from server %d on first attempt\n", n)); } } catch (const CORBA::Exception &ex) { ex._tao_print_exception ("Client caught: "); #if 0 try { if (CORBA::is_nil (test.in())) { test = Test::_narrow( obj.in() ); } CORBA::Short n = test->get_server_num (); ACE_DEBUG ((LM_DEBUG, "Client received reply from server %d on second attempt\n", n)); } catch (const CORBA::Exception &ex) { ex._tao_print_exception ("Client second attempt: "); } #endif } orb->destroy (); return 0; } catch (const CORBA::Exception& ex) { ex._tao_print_exception ("client:"); } return -1; }