summaryrefslogtreecommitdiff
path: root/ACE/TAO/examples/Simple/echo/Echo_Client_i.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ACE/TAO/examples/Simple/echo/Echo_Client_i.cpp')
-rw-r--r--ACE/TAO/examples/Simple/echo/Echo_Client_i.cpp61
1 files changed, 61 insertions, 0 deletions
diff --git a/ACE/TAO/examples/Simple/echo/Echo_Client_i.cpp b/ACE/TAO/examples/Simple/echo/Echo_Client_i.cpp
new file mode 100644
index 00000000000..b70765c6c83
--- /dev/null
+++ b/ACE/TAO/examples/Simple/echo/Echo_Client_i.cpp
@@ -0,0 +1,61 @@
+//$Id$
+
+#include "Echo_Client_i.h"
+#include "ace/Get_Opt.h"
+#include "ace/Read_Buffer.h"
+#include "ace/OS_NS_unistd.h"
+
+// This is the interface program that accesses the remote object
+
+// Constructor.
+Echo_Client_i::Echo_Client_i (void)
+{
+ //no-op
+}
+
+//Destructor.
+Echo_Client_i::~Echo_Client_i (void)
+{
+ //no-op
+}
+
+int
+Echo_Client_i::run (const char *name,
+ int argc,
+ ACE_TCHAR *argv[])
+{
+ // Initialize the client.
+ if (client_.init (name, argc, argv) == -1)
+ return -1;
+
+ try
+ {
+ while (1)
+ {
+ char buf[BUFSIZ];
+
+ // Get the input message which has to be displayed.
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("ECHO? ")));
+
+ if (ACE_OS::fgets (buf, sizeof buf, stdin) == 0)
+ break;
+
+ CORBA::String_var s = client_->echo_string (buf);
+
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("\nString echoed by client \n%C\n"),
+ s.in ()));
+ }
+
+ if (client_.do_shutdown () == 1)
+ client_->shutdown ();
+ }
+ catch (const CORBA::Exception& ex)
+ {
+ ex._tao_print_exception ("\n Exception in RMI");
+ return -1;
+ }
+
+ return 0;
+}