1 #include "UDP_Client_i.h"
2 #include "ace/SString.h"
3 #include "ace/OS_NS_unistd.h"
5 // This is the interface program that accesses the remote object
8 UDP_Client_i::UDP_Client_i (CORBA::ORB_ptr orb
,
12 ACE_UINT32 iterations
)
13 : orb_ (CORBA::ORB::_duplicate (orb
))
14 , udp_ (UDP::_duplicate (udp
))
15 , udpHandler_ (UDP::_duplicate (udpHandler
))
17 , iterations_ (iterations
)
23 UDP_Client_i::~UDP_Client_i (void)
29 UDP_Client_i::svc (void)
31 ACE_CString
client_name ("UDP");
36 static_cast<u_int
> (ACE_OS::getpid ()));
43 CORBA::String_var corba_client_name
=
44 CORBA::string_dup (client_name
.c_str ());
46 for (ACE_UINT32 i
= 0;
50 udp_
->invoke (corba_client_name
.in (),
55 "invoked %C %d, going to wait %d ms\n",
56 corba_client_name
.in (),
59 ACE_Time_Value
tv (0, delay_
* 1000);
60 ACE_OS::sleep (tv
); // wait to not flood the server
63 // shut down remote ORB
64 for (int c
= 0; c
< 10; ++c
)
67 ACE_Time_Value
tv (0, 500); // 50ms
68 ACE_OS::sleep (tv
); // let the previous request go through
70 // Shut down local ORB, trigger the end of the ORB event loop
71 // in the main thread.
75 catch (const CORBA::Exception
& ex
)
77 ex
._tao_print_exception ("\tException");