3 #include "Client_Task.h"
5 #include "ace/Get_Opt.h"
6 #include "ace/Argv_Type_Converter.h"
7 #include "tao/ORB_Core.h"
8 // Ensure that the PI library is linked in when building statically
10 #include "Server_Task.h"
12 //////////////////////////////////////////////////////////////////////////
14 ACE_TString
collocated_ior_file(ACE_TEXT("collocated_server.ior"));
15 ACE_TString
server_ior_file(ACE_TEXT("server.ior"));
17 //////////////////////////////////////////////////////////////////////////
20 parse_args (int argc
, ACE_TCHAR
*argv
[])
22 ACE_Get_Opt
get_opts (argc
, argv
, ACE_TEXT("s:o:"));
25 while ((c
= get_opts ()) != -1)
29 server_ior_file
= get_opts
.opt_arg ();
32 collocated_ior_file
= get_opts
.opt_arg ();
36 ACE_ERROR_RETURN ((LM_ERROR
,
39 "-o <collocated_iorfile>"
45 // Indicates successful parsing of the command line
50 ACE_TMAIN(int argc
, ACE_TCHAR
*argv
[])
54 ACE_CString server_orb
;
55 server_orb
.set ("server_orb");
56 ACE_CString client_orb
;
57 client_orb
.set ("client_orb");
61 ACE_Argv_Type_Converter
satc (argc
, argv
);
63 CORBA::ORB_init (satc
.get_argc (),
64 satc
.get_TCHAR_argv (),
67 ACE_Argv_Type_Converter
catc (argc
, argv
);
69 CORBA::ORB_init (catc
.get_argc (),
70 catc
.get_TCHAR_argv (),
73 if (parse_args (argc
, argv
) != 0)
79 Server_Task
server_task (collocated_ior_file
.c_str(),
82 ACE_Thread_Manager::instance ());
84 if (server_task
.activate (THR_NEW_LWP
| THR_JOINABLE
,
88 ACE_ERROR ((LM_ERROR
, "Error activating server task\n"));
91 // Wait for the server thread to do some processing
94 Client_Task
client_task (corb
.in (),
95 ACE_Thread_Manager::instance (),
96 collocated_ior_file
, server_ior_file
);
98 if (client_task
.activate (THR_NEW_LWP
| THR_JOINABLE
,
102 ACE_ERROR ((LM_ERROR
, "Error activating client task\n"));
105 ACE_Thread_Manager::instance ()->wait ();
110 catch (const CORBA::Exception
& ex
)
112 ex
._tao_print_exception ("Exception caught:");
118 ACE_DEBUG ((LM_ERROR
, "Test failed.\n") );