1 #include "MessengerC.h"
3 #include "ace/Log_Msg.h"
4 #include "ace/SString.h"
5 #include "ace/Get_Opt.h"
7 const ACE_TCHAR
*ior
= ACE_TEXT("file://messenger.ior");
10 parse_args (int argc
, ACE_TCHAR
*argv
[])
12 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("k:"));
15 while ((c
= get_opts ()) != -1)
19 ior
= get_opts
.opt_arg ();
24 ACE_ERROR_RETURN ((LM_ERROR
,
31 // Indicates successful parsing of the command line
35 int ACE_TMAIN (int argc
, ACE_TCHAR
*argv
[])
39 CORBA::ORB_var orb
= CORBA::ORB_init (argc
, argv
);
41 if (parse_args (argc
, argv
) != 0)
44 CORBA::Object_var obj
= orb
->string_to_object (ior
);
45 Messenger_var messenger
= Messenger::_narrow (obj
.in ());
46 if (CORBA::is_nil (messenger
.in ()))
48 ACE_ERROR_RETURN ((LM_ERROR
,
49 ACE_TEXT ("Unable to get a Messenger reference.\n")),
53 CORBA::String_var message
= CORBA::string_dup("Hello!");
54 for (int i(0); i
< 6; ++i
)
58 messenger
->send_message("TAO User", "TAO Test",
60 ACE_DEBUG ((LM_DEBUG
, ACE_TEXT("Message was sent\n")
61 ACE_TEXT("Client got reply: %C\n"),
64 catch (const CORBA::Exception
&ex
)
66 ACE_CString str
= ex
._info ();
67 ACE_ERROR_RETURN ((LM_ERROR
,
68 ACE_TEXT ("Client send_message () caught: %C\n"),
77 catch (const CORBA::Exception
&ex
)
79 ACE_CString str
= ex
._info ();
80 ACE_ERROR_RETURN ((LM_ERROR
, ACE_TEXT ("Client main() caught: %C\n"),