summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/IOR_MCast/ior_mcast_client_i.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/orbsvcs/tests/IOR_MCast/ior_mcast_client_i.cpp')
-rw-r--r--TAO/orbsvcs/tests/IOR_MCast/ior_mcast_client_i.cpp80
1 files changed, 80 insertions, 0 deletions
diff --git a/TAO/orbsvcs/tests/IOR_MCast/ior_mcast_client_i.cpp b/TAO/orbsvcs/tests/IOR_MCast/ior_mcast_client_i.cpp
new file mode 100644
index 00000000000..26a0d6c3e12
--- /dev/null
+++ b/TAO/orbsvcs/tests/IOR_MCast/ior_mcast_client_i.cpp
@@ -0,0 +1,80 @@
+// $Id$
+
+#include "ior_mcast_client_i.h"
+#include "ace/Get_Opt.h"
+#include "ace/Read_Buffer.h"
+
+ior_mcast_Client_i::ior_mcast_Client_i (void)
+{
+ // Constructor
+}
+
+ior_mcast_Client_i::~ior_mcast_Client_i (void)
+{
+}
+
+int
+ior_mcast_Client_i::init (int& argc,
+ char *argv[]
+ ACE_ENV_ARG_DECL)
+{
+
+ ACE_TRY
+ {
+ // First initialize the ORB, that will remove some arguments...
+ CORBA::ORB_var orb =
+ CORBA::ORB_init (argc,
+ argv,
+ "" /* the ORB name, it can be anything! */
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ CORBA::Object_var mcast_server_object =
+ orb->resolve_initial_references ("MCASTServer" ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (mcast_server_object.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot resolve MCast Server\n : client"),
+ -1);
+
+ MCast::Server_var mcast_srvr =
+ MCast::Server::_narrow (mcast_server_object.in () ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (CORBA::is_nil (mcast_srvr.in ()))
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Cannot narrow MCast Service\n :client"),
+ -1);
+
+ // Invoke a request on the server
+ CORBA::Boolean ret_value =
+ mcast_srvr->connect_server (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ if (ret_value != 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "The server has not been contacted. Error!!\n"),
+ -1);
+ }
+ else
+ {
+ ACE_DEBUG ((LM_DEBUG,
+ "The server has been successfully contacted!\n"));
+ }
+ }
+ ACE_CATCH (CORBA::SystemException, ex)
+ {
+ ACE_PRINT_EXCEPTION (ex, "client");
+ return -1;
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "client");
+ }
+ ACE_ENDTRY;
+ ACE_CHECK_RETURN (-1);
+
+ return 0;
+}