summaryrefslogtreecommitdiff
path: root/examples/Reactor/Dgram
diff options
context:
space:
mode:
Diffstat (limited to 'examples/Reactor/Dgram')
-rw-r--r--examples/Reactor/Dgram/CODgram.cpp121
-rw-r--r--examples/Reactor/Dgram/Dgram.cpp121
-rw-r--r--examples/Reactor/Dgram/Makefile129
3 files changed, 0 insertions, 371 deletions
diff --git a/examples/Reactor/Dgram/CODgram.cpp b/examples/Reactor/Dgram/CODgram.cpp
deleted file mode 100644
index 6c4bc0f8052..00000000000
--- a/examples/Reactor/Dgram/CODgram.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Exercise the ACE_SOCK_CODgram wrapper along with the ACE_Reactor.
-// $Id$
-
-
- Typical invocation sequence is:
-
- % CODgram 10000 localhost 10001 &
- % CODgram 10001 localhost 10000
-
- This will start two interacting copies of the CODgram
- application. */
-
-#include "ace/Reactor.h"
-#include "ace/SOCK_CODgram.h"
-#include "ace/INET_Addr.h"
-
-class AAL_CP : public ACE_Event_Handler, public ACE_SOCK_CODgram
-{
-public:
- AAL_CP (const ACE_INET_Addr &remote_addr,
- const ACE_INET_Addr &local_addr);
-
- virtual int get_handle () const;
-
- virtual int handle_input (int fd);
-
- virtual int handle_timeout (const ACE_Time_Value & tv,
- const void *arg = 0);
-};
-
-AAL_CP::AAL_CP (const ACE_INET_Addr &remote_addr,
- const ACE_INET_Addr &local_addr)
- : ACE_SOCK_CODgram (remote_addr, local_addr)
-{
-}
-
-int
-AAL_CP::get_handle () const
-{
- return ACE_SOCK_CODgram::get_handle ();
-}
-
-int
-AAL_CP::handle_input (int)
-{
- char buf[128];
- int n;
- ACE_DEBUG ((LM_DEBUG, "Activity occurred on handle %d!\n",
- ACE_SOCK_CODgram::get_handle ()));
- if ((n = ACE_SOCK_CODgram::recv (buf, sizeof buf)) == -1)
- ACE_ERROR ((LM_ERROR, "%p\n", "handle_input"));
- else
- ACE_DEBUG ((LM_DEBUG, "got buf = %s\n", buf));
-
- return 0;
-}
-
-int
-AAL_CP::handle_timeout (const ACE_Time_Value &, const void *)
-{
- ACE_DEBUG ((LM_DEBUG, "timed out for aa1\n"));
- return 0;
-}
-
-main(int argc, char *argv[])
-{
- /* Estabish call backs, and socket names */
- if (argc != 4)
- ACE_ERROR_RETURN ((LM_ERROR,
- "usage: %s localport remotehost remoteport\n",
- argv[0]), -1);
-
- ACE_Reactor reactor;
- char buf[128];
- u_short localport = ACE_OS::atoi (argv[1]);
- u_short remoteport = ACE_OS::atoi (argv[3]);
- char *remotehost = argv[2];
-
- ACE_INET_Addr remote_addr (remoteport, remotehost);
- ACE_INET_Addr local_addr (localport);
-
- AAL_CP aal (remote_addr, local_addr);
-
- if (localport == 10000) // HACK
- {
- ACE_OS::memcpy (buf, "Data to transmit", sizeof buf);
- ACE_DEBUG ((LM_DEBUG, "sending data\n"));
-
- for (int i = 0; i < 20; i++)
- {
- aal.send (buf, sizeof buf);
- ACE_DEBUG ((LM_DEBUG, ".\n"));
- ACE_OS::sleep (1);
- }
- }
-
- /* read data from other side */
- if (reactor.register_handler (&aal, ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "ACE_Reactor::register_handler"), -1);
-
- if (reactor.schedule_timer (&aal, 0,
- ACE_Time_Value (1, 0),
- ACE_Time_Value (0, 3500000)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "ACE_Reactor::schedule_timer"), -1);
-
- ACE_OS::memcpy (buf, "Data to transmit", sizeof buf);
-
- for (;;)
- {
- /* Wait at most two seconds */
- ACE_Time_Value tv (2, 0);
-
- reactor.handle_events (tv);
-
- ACE_DEBUG ((LM_DEBUG, "return from handle events\n"));
- aal.send (buf, sizeof buf);
- ACE_DEBUG ((LM_DEBUG, ".\n"));
- }
-
- return 0;
-}
diff --git a/examples/Reactor/Dgram/Dgram.cpp b/examples/Reactor/Dgram/Dgram.cpp
deleted file mode 100644
index c418c3b79d2..00000000000
--- a/examples/Reactor/Dgram/Dgram.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-// Exercise the ACE_SOCK_Dgram wrapper along with the ACE_Reactor.
-// $Id$
-
-// Typical invocation sequence is:
-//
-// % Dgram 10000 localhost 10001 &
-// % Dgram 10001 localhost 10000
-//
-// This will start two interacting copies of the Dgram
-// application.
-
-#include "ace/Reactor.h"
-#include "ace/SOCK_Dgram.h"
-#include "ace/INET_Addr.h"
-
-class AAL_CP : public ACE_Event_Handler, public ACE_SOCK_Dgram
-{
-public:
- AAL_CP (const ACE_INET_Addr &local_addr);
-
- virtual ACE_HANDLE get_handle (void) const;
-
- virtual int handle_input (ACE_HANDLE handle);
-
- virtual int handle_timeout (const ACE_Time_Value & tv,
- const void *arg = 0);
-};
-
-AAL_CP::AAL_CP (const ACE_INET_Addr &local_addr)
- : ACE_SOCK_Dgram (local_addr)
-{
-}
-
-ACE_HANDLE
-AAL_CP::get_handle (void) const
-{
- return ACE_SOCK_Dgram::get_handle ();
-}
-
-int
-AAL_CP::handle_input (ACE_HANDLE)
-{
- char buf[BUFSIZ];
- int n;
- ACE_INET_Addr from_addr;
-
- ACE_DEBUG ((LM_DEBUG, "Activity occurred on handle %d!\n",
- ACE_SOCK_Dgram::get_handle ()));
- if ((n = ACE_SOCK_Dgram::recv (buf, sizeof buf, from_addr)) == -1)
- ACE_ERROR ((LM_ERROR, "%p\n", "handle_input"));
- else
- ACE_DEBUG ((LM_DEBUG, "got buf = %s\n", buf));
-
- return 0;
-}
-
-int
-AAL_CP::handle_timeout (const ACE_Time_Value &, const void *)
-{
- ACE_DEBUG ((LM_DEBUG, "timed out for aa1\n"));
- return 0;
-}
-
-int
-main (int argc, char *argv[])
-{
- // Estabish call backs, and socket names.
- if (argc != 4)
- ACE_ERROR_RETURN ((LM_ERROR,
- "usage: %s localport remotehost remoteport\n",
- argv[0]), -1);
-
- ACE_Reactor reactor;
- char buf[128];
- u_short localport = ACE_OS::atoi (argv[1]);
- u_short remoteport = ACE_OS::atoi (argv[3]);
- char *remotehost = argv[2];
-
- ACE_INET_Addr remote_addr (remoteport, remotehost);
- ACE_INET_Addr local_addr (localport);
-
- AAL_CP aal (local_addr);
-
- if (localport == 10000) // HACK
- {
- ACE_OS::memcpy (buf, "Data to transmit", sizeof buf);
- ACE_DEBUG ((LM_DEBUG, "sending data\n"));
-
- for (size_t i = 0; i < 20; i++)
- {
- aal.send (buf, sizeof buf, remote_addr);
- ACE_DEBUG ((LM_DEBUG, ".\n"));
- ACE_OS::sleep (1);
- }
- }
-
- // Read data from other side.
- if (reactor.register_handler (&aal, ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "ACE_Reactor::register_handler"), -1);
-
- if (reactor.schedule_timer (&aal, 0,
- ACE_Time_Value (1, 0),
- ACE_Time_Value (0, 3500000)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "ACE_Reactor::schedule_timer"), -1);
-
- ACE_OS::memcpy (buf, "Data to transmit", sizeof buf);
-
- for (;;)
- {
- // Wait at most two seconds.
- ACE_Time_Value tv (2, 0);
-
- reactor.handle_events (tv);
-
- ACE_DEBUG ((LM_DEBUG, "return from handle events\n"));
- aal.send (buf, sizeof buf, remote_addr);
- ACE_DEBUG ((LM_DEBUG, ".\n"));
- }
-
- return 0;
-}
diff --git a/examples/Reactor/Dgram/Makefile b/examples/Reactor/Dgram/Makefile
deleted file mode 100644
index 53760e3be11..00000000000
--- a/examples/Reactor/Dgram/Makefile
+++ /dev/null
@@ -1,129 +0,0 @@
-#----------------------------------------------------------------------------
-# @(#)Makefile 1.1 10/18/96
-#
-# Makefile for a test of the CODgram and Dgram facilities and the Reactor
-#----------------------------------------------------------------------------
-
-#----------------------------------------------------------------------------
-# Local macros
-#----------------------------------------------------------------------------
-
-BIN = CODgram Dgram
-
-LSRC = CODgram.cpp Dgram.cpp
-
-LDLIBS =
-
-VLDLIBS = $(LDLIBS:%=%$(VAR))
-
-BUILD = $(VBIN)
-
-INSTALL =
-
-#----------------------------------------------------------------------------
-# Include macros and targets
-#----------------------------------------------------------------------------
-
-include $(WRAPPER_ROOT)/include/makeinclude/wrapper_macros.GNU
-include $(WRAPPER_ROOT)/include/makeinclude/macros.GNU
-include $(WRAPPER_ROOT)/include/makeinclude/rules.common.GNU
-include $(WRAPPER_ROOT)/include/makeinclude/rules.nonested.GNU
-include $(WRAPPER_ROOT)/include/makeinclude/rules.bin.GNU
-include $(WRAPPER_ROOT)/include/makeinclude/rules.local.GNU
-
-#----------------------------------------------------------------------------
-# Local targets
-#----------------------------------------------------------------------------
-
-#----------------------------------------------------------------------------
-# Dependencies
-#----------------------------------------------------------------------------
-# DO NOT DELETE THIS LINE -- g++dep uses it.
-# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.
-
-.obj/CODgram.o .shobj/CODgram.so: CODgram.cpp \
- $(WRAPPER_ROOT)/ace/Reactor.h \
- $(WRAPPER_ROOT)/ace/Handle_Set.h \
- $(WRAPPER_ROOT)/ace/ACE.h \
- $(WRAPPER_ROOT)/ace/OS.h \
- $(WRAPPER_ROOT)/ace/Time_Value.h \
- $(WRAPPER_ROOT)/ace/config.h \
- $(WRAPPER_ROOT)/ace/stdcpp.h \
- $(WRAPPER_ROOT)/ace/Trace.h \
- $(WRAPPER_ROOT)/ace/Log_Msg.h \
- $(WRAPPER_ROOT)/ace/Log_Record.h \
- $(WRAPPER_ROOT)/ace/Log_Priority.h \
- $(WRAPPER_ROOT)/ace/Log_Record.i \
- $(WRAPPER_ROOT)/ace/ACE.i \
- $(WRAPPER_ROOT)/ace/Timer_Queue.h \
- $(WRAPPER_ROOT)/ace/Event_Handler.h \
- $(WRAPPER_ROOT)/ace/Synch.h \
- $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \
- $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \
- $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \
- $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \
- $(WRAPPER_ROOT)/ace/Synch_T.h \
- $(WRAPPER_ROOT)/ace/Timer_Queue.i \
- $(WRAPPER_ROOT)/ace/Signal.h \
- $(WRAPPER_ROOT)/ace/Set.h \
- $(WRAPPER_ROOT)/ace/Thread.h \
- $(WRAPPER_ROOT)/ace/Token.h \
- $(WRAPPER_ROOT)/ace/Pipe.h \
- $(WRAPPER_ROOT)/ace/Pipe.i \
- $(WRAPPER_ROOT)/ace/SOCK_Stream.h \
- $(WRAPPER_ROOT)/ace/SOCK_IO.h \
- $(WRAPPER_ROOT)/ace/SOCK.h \
- $(WRAPPER_ROOT)/ace/Addr.h \
- $(WRAPPER_ROOT)/ace/IPC_SAP.h \
- $(WRAPPER_ROOT)/ace/IPC_SAP.i \
- $(WRAPPER_ROOT)/ace/SOCK.i \
- $(WRAPPER_ROOT)/ace/SOCK_IO.i \
- $(WRAPPER_ROOT)/ace/INET_Addr.h \
- $(WRAPPER_ROOT)/ace/SOCK_Stream.i \
- $(WRAPPER_ROOT)/ace/Reactor.i \
- $(WRAPPER_ROOT)/ace/SOCK_CODgram.h \
- $(WRAPPER_ROOT)/ace/SOCK_CODgram.i
-.obj/Dgram.o .shobj/Dgram.so: Dgram.cpp \
- $(WRAPPER_ROOT)/ace/Reactor.h \
- $(WRAPPER_ROOT)/ace/Handle_Set.h \
- $(WRAPPER_ROOT)/ace/ACE.h \
- $(WRAPPER_ROOT)/ace/OS.h \
- $(WRAPPER_ROOT)/ace/Time_Value.h \
- $(WRAPPER_ROOT)/ace/config.h \
- $(WRAPPER_ROOT)/ace/stdcpp.h \
- $(WRAPPER_ROOT)/ace/Trace.h \
- $(WRAPPER_ROOT)/ace/Log_Msg.h \
- $(WRAPPER_ROOT)/ace/Log_Record.h \
- $(WRAPPER_ROOT)/ace/Log_Priority.h \
- $(WRAPPER_ROOT)/ace/Log_Record.i \
- $(WRAPPER_ROOT)/ace/ACE.i \
- $(WRAPPER_ROOT)/ace/Timer_Queue.h \
- $(WRAPPER_ROOT)/ace/Event_Handler.h \
- $(WRAPPER_ROOT)/ace/Synch.h \
- $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.h \
- $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.h \
- $(WRAPPER_ROOT)/ace/SV_Semaphore_Simple.i \
- $(WRAPPER_ROOT)/ace/SV_Semaphore_Complex.i \
- $(WRAPPER_ROOT)/ace/Synch_T.h \
- $(WRAPPER_ROOT)/ace/Timer_Queue.i \
- $(WRAPPER_ROOT)/ace/Signal.h \
- $(WRAPPER_ROOT)/ace/Set.h \
- $(WRAPPER_ROOT)/ace/Thread.h \
- $(WRAPPER_ROOT)/ace/Token.h \
- $(WRAPPER_ROOT)/ace/Pipe.h \
- $(WRAPPER_ROOT)/ace/Pipe.i \
- $(WRAPPER_ROOT)/ace/SOCK_Stream.h \
- $(WRAPPER_ROOT)/ace/SOCK_IO.h \
- $(WRAPPER_ROOT)/ace/SOCK.h \
- $(WRAPPER_ROOT)/ace/Addr.h \
- $(WRAPPER_ROOT)/ace/IPC_SAP.h \
- $(WRAPPER_ROOT)/ace/IPC_SAP.i \
- $(WRAPPER_ROOT)/ace/SOCK.i \
- $(WRAPPER_ROOT)/ace/SOCK_IO.i \
- $(WRAPPER_ROOT)/ace/INET_Addr.h \
- $(WRAPPER_ROOT)/ace/SOCK_Stream.i \
- $(WRAPPER_ROOT)/ace/Reactor.i \
- $(WRAPPER_ROOT)/ace/SOCK_Dgram.h \
- $(WRAPPER_ROOT)/ace/SOCK_Dgram.i
-
-# IF YOU PUT ANYTHING HERE IT WILL GO AWAY