2 #include "tao/TransportCurrent/IIOP_Transport_Current.h"
3 #include "tao/SystemException.h"
5 #if defined (TAO_AS_STATIC_LIBS)
6 #include "tao/TransportCurrent/IIOP_Current_Loader.h"
8 // Create an object that will insert the <Current_Loader> into the
9 // list of statically linked services that the <ACE_Service_Config>
10 // will initialize at run-time.
11 ACE_STATIC_SVC_REQUIRE (TAO_Transport_Current_Loader
)
12 ACE_STATIC_SVC_REQUIRE (TAO_Transport_IIOP_Current_Loader
)
13 #endif /* TAO_AS_STATIC_LIBS */
17 /// Test referencing the TC data outside of the context of an upcall,
18 /// or a client-side interceptor
21 test_transport_current (CORBA::ORB_ptr orb
)
23 // Get the Current object.
24 CORBA::Object_var tcobject
=
25 orb
->resolve_initial_references ("TAO::Transport::IIOP::Current");
27 if (TAO_debug_level
>= 1)
29 ACE_TEXT ("Tester (%P|%t) Resolved initial reference for IIOP::Current\n")));
31 Transport::IIOP::Current_var tc
=
32 Transport::IIOP::Current::_narrow (tcobject
.in ());
34 if (TAO_debug_level
>= 1)
36 ACE_TEXT ("Tester (%P|%t) Narowed the IIOP Transport Current\n")));
38 if (CORBA::is_nil (tc
.in ()))
41 ACE_TEXT ("Tester (%P|%t) ERROR: Could not resolve ")
42 ACE_TEXT ("TAO::Transport::IIOP::Current object.\n")));
44 throw CORBA::INTERNAL ();
47 ::CORBA::String_var
rhost (tc
->remote_host ());
49 ::CORBA::String_var
lhost (tc
->local_host ());
51 ::CORBA::Long id
= tc
->id ();
53 ::TAO::CounterT bs
= tc
->bytes_sent ();
55 ::TAO::CounterT br
= tc
->bytes_received ();
57 ::TAO::CounterT rs
= tc
->messages_sent ();
59 ::TAO::CounterT rr
= tc
->messages_received ();
62 ACE_TEXT ("Tester (%P|%t) Transport [%q] [%C:%d -> %C:%d] ")
63 ACE_TEXT ("Sent/Received [bytes=%q/%q, messages=%q/%q]\n"),
65 rhost
.in (), tc
->remote_port (),
66 lhost
.in (), tc
->local_port (),