summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-08-30 23:57:18 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-08-30 23:57:18 +0000
commit6affa7d2822b5341ad0c2b59b27156502ef982be (patch)
treeb5e6324363239d238305a90dafde7f05175433fc /docs
parentf10b722dde975bd8afc7a6e684989aec1244ba94 (diff)
downloadATCD-6affa7d2822b5341ad0c2b59b27156502ef982be.tar.gz
Removed the 005a directory on Doug's request
Diffstat (limited to 'docs')
-rw-r--r--docs/tutorials/005a/00SetEnv2
-rw-r--r--docs/tutorials/005a/DEADJOE158
-rw-r--r--docs/tutorials/005a/Makefile42
-rw-r--r--docs/tutorials/005a/Makefile4broken42
-rw-r--r--docs/tutorials/005a/acceptor6
-rw-r--r--docs/tutorials/005a/handler81
-rw-r--r--docs/tutorials/005a/main36
-rw-r--r--docs/tutorials/005a/main.cpp34
-rw-r--r--docs/tutorials/005a/page01.html59
-rw-r--r--docs/tutorials/005a/page02.html178
-rw-r--r--docs/tutorials/005a/page03.html65
-rw-r--r--docs/tutorials/005a/page04.html274
-rw-r--r--docs/tutorials/005a/page04a.html97
-rw-r--r--docs/tutorials/005a/page05.html97
-rw-r--r--docs/tutorials/005a/page06.html42
-rw-r--r--docs/tutorials/005a/serverbin159201 -> 0 bytes
-rw-r--r--docs/tutorials/005a/server.bck160
-rw-r--r--docs/tutorials/005a/server.cpp145
-rw-r--r--docs/tutorials/005a/server.dyn144
-rw-r--r--docs/tutorials/005a/server.news139
-rw-r--r--docs/tutorials/005a/serverBrokenbin159171 -> 0 bytes
-rw-r--r--docs/tutorials/005a/serverBroken.cpp143
22 files changed, 0 insertions, 1944 deletions
diff --git a/docs/tutorials/005a/00SetEnv b/docs/tutorials/005a/00SetEnv
deleted file mode 100644
index 33ba8135007..00000000000
--- a/docs/tutorials/005a/00SetEnv
+++ /dev/null
@@ -1,2 +0,0 @@
-export WRAPPER_ROOT=/local/src/ACE/ACE_wrappers
-export LD_LIBRARY_PATH=$WRAPPER_ROOT/ace:$LD_LIBRARY_PATH
diff --git a/docs/tutorials/005a/DEADJOE b/docs/tutorials/005a/DEADJOE
deleted file mode 100644
index 5ca99006390..00000000000
--- a/docs/tutorials/005a/DEADJOE
+++ /dev/null
@@ -1,158 +0,0 @@
-
-*** Modified files in JOE when it aborted on Wed Jan 15 17:57:14 1997
-*** JOE was aborted because the terminal closed
-
-*** File 'server.cpp'
-
-#include "ace/Acceptor.h"
-#include "ace/SOCK_Acceptor.h"
-#include "ace/Reactor.h"
-#include "ace/Thread.h"
-
-
-ACE_Reactor * g_reactor;
-
-static sig_atomic_t finished = 0;
-
-
-extern "C" void handler (int) { finished = 1; }
-static void *thread_run(void *);
-// ----------------------------------------
-
-class Logging_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
-{
-
-public:
-
- Logging_Handler (void)
- {
- cout << __LINE__ << " " << getpid() << endl;
- thread_reactor = NULL;
- }
-
- ~Logging_Handler (void)
- {
- cout << __LINE__ << " " << getpid() << endl;
- //Warning !!! segfault potential here !!!
- // cerr << "Deleting " << thread_reactor << endl;
- //thread_reactor->remove_handler(this,ACE_Event_Handler::READ_MASK);
- //delete thread_reactor;
- }
-
- virtual void destroy (void)
- {
- cout << __LINE__ << " " << getpid() << endl;
-
- g_reactor->cancel_timer (this);
- this->peer ().close ();
-
- //delete thread_reactor;
- delete this;
- }
-
- static void *run_thread(Logging_Handler *this_)
- {
- cout << "run_thread in " << getpid() << endl;
-
- this_->thread_reactor = new ACE_Reactor;
-
- if (this_->thread_reactor->register_handler(this_, ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) can't register with reactor\n"), -1);
-
- else if (this_->thread_reactor->schedule_timer (this_, (const void *)this_, ACE_Time_Value (2), ACE_Time_Value (2)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "can'(%P|%t) t register with reactor\n"), -1);
-
- else
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) connected with client \n"));
-
- while(!finished)
- this_->thread_reactor->handle_events() != -1;
-
- }
-
- virtual int open (void *)
- {
- cout << "open in " << getpid() << endl;
-
- ACE_Thread::spawn(&Logging_Handler::run_thread,this);
- return 0;
- }
-
- virtual int close (u_long)
- {
- cout << __LINE__ << " " << getpid() << endl;
- this->destroy ();
- return 0;
- }
-
-protected:
-
- virtual int handle_input (ACE_HANDLE)
- {
- char buf[128];
- memset(buf,0,sizeof(buf));
-
- cout << "handle_input in " << getpid() << endl;
- switch( this->peer().recv(buf,sizeof buf) )
- {
- case -1:
- ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p bad read\n", "client logger"), -1);
- case 0:
- ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) closing log daemon (fd = %d)\n", this->get_handle ()), -1);
- default:
- cout << "Data from client " << buf << endl;
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) from client: %s",buf));
- }
-
- return 0;
- }
-
- virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg)
- {
- ACE_ASSERT (arg == this);
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) handling timeout from this = %u\n", this));
- cout << "Timout in " << getpid() << endl;
- return 0;
- }
-
-private:
- ACE_Reactor *thread_reactor;
- char peer_name_[MAXHOSTNAMELEN + 1];
-
-};
-
-
-typedef ACE_Acceptor <Logging_Handler, ACE_SOCK_ACCEPTOR> Logging_Acceptor;
-
-
-static const u_short PORT = ACE_DEFAULT_SERVER_PORT;
-
-int main (int argc, char *argv[])
-{
- g_reactor = new ACE_Reactor;
-
- cout << "main is " << getpid() << endl;
-
- // Acceptor factory.
- Logging_Acceptor peer_acceptor;
-
- if (peer_acceptor.open (ACE_INET_Addr (PORT)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
-
- else if (g_reactor->register_handler (&peer_acceptor, ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "registering service with ACE_Reactor\n"), -1);
-
- ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
-
- // Run forever, performing logging service.
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting up server logging daemon\n"));
-
- // Perform logging service until QUIT_HANDLER receives SIGINT.
- while ( !finished )
- g_reactor->handle_events ();
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) shutting down server logging daemon\n"));
-
- return 0;
-}
diff --git a/docs/tutorials/005a/Makefile b/docs/tutorials/005a/Makefile
deleted file mode 100644
index ec3e3bd243c..00000000000
--- a/docs/tutorials/005a/Makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-#----------------------------------------------------------------------------
-# $Id$
-#
-# Makefile for the Reactor version of the Server Logging Daemon
-#----------------------------------------------------------------------------
-
-#----------------------------------------------------------------------------
-# Local macros
-#----------------------------------------------------------------------------
-
-BIN = server
-
-VLDLIBS = $(LDLIBS:%=%$(VAR))
-
-BUILD = $(VBIN)
-
-#----------------------------------------------------------------------------
-# 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.lib.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.
-
-
-
-# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/docs/tutorials/005a/Makefile4broken b/docs/tutorials/005a/Makefile4broken
deleted file mode 100644
index 872a0346132..00000000000
--- a/docs/tutorials/005a/Makefile4broken
+++ /dev/null
@@ -1,42 +0,0 @@
-#----------------------------------------------------------------------------
-# @(#)Makefile 1.1 10/18/96
-#
-# Makefile for the Reactor version of the Server Logging Daemon
-#----------------------------------------------------------------------------
-
-#----------------------------------------------------------------------------
-# Local macros
-#----------------------------------------------------------------------------
-
-BIN = serverBroken
-
-VLDLIBS = $(LDLIBS:%=%$(VAR))
-
-BUILD = $(VBIN)
-
-#----------------------------------------------------------------------------
-# 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.lib.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.
-
-
-
-# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
diff --git a/docs/tutorials/005a/acceptor b/docs/tutorials/005a/acceptor
deleted file mode 100644
index 45409e4ec3e..00000000000
--- a/docs/tutorials/005a/acceptor
+++ /dev/null
@@ -1,6 +0,0 @@
-
-1. #include "ace/Acceptor.h"
-2. #include "ace/SOCK_Acceptor.h"
-
-3. typedef ACE_Acceptor <Logging_Handler, ACE_SOCK_ACCEPTOR> Logging_Acceptor;
-
diff --git a/docs/tutorials/005a/handler b/docs/tutorials/005a/handler
deleted file mode 100644
index d987f4c34ff..00000000000
--- a/docs/tutorials/005a/handler
+++ /dev/null
@@ -1,81 +0,0 @@
-
-1. #include "ace/SOCK_Acceptor.h"
-2. #include "ace/Reactor.h"
-
-
-3. class Logging_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
- {
-
- public:
-
-4. Logging_Handler (void)
- {
- }
-
-5. virtual void destroy (void)
- {
-6. g_reactor->cancel_timer (this);
-7. this->peer ().close ();
- }
-
-8. virtual int open (void *)
- {
-9. ACE_INET_Addr addr;
-
-10. if (this->peer ().get_remote_addr (addr) == -1)
-11. return -1;
-12. else
- {
-13. ACE_OS::strncpy (this->peer_name_, addr.get_host_name (), MAXHOSTNAMELEN + 1);
-
-14. if (g_reactor->register_handler(this, ACE_Event_Handler::READ_MASK) == -1)
-15. ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) can't register with reactor\n"), -1);
-
-16. else if (g_reactor->schedule_timer (this, (const void *) this, ACE_Time_Value (2), ACE_Time_Value (2)) == -1)
-17. ACE_ERROR_RETURN ((LM_ERROR, "can'(%P|%t) t register with reactor\n"), -1);
-
-18. else
-19. ACE_DEBUG ((LM_DEBUG, "(%P|%t) connected with %s\n", this->peer_name_));
-
-20. return 0;
- }
- }
-
-21. virtual int close (u_long)
- {
-22. this->destroy ();
-23. return 0;
- }
-
- protected:
-
-24. virtual int handle_input (ACE_HANDLE)
- {
-25. char buf[128];
-26. memset(buf,0,sizeof(buf));
-
-27. switch( this->peer().recv(buf,sizeof buf) )
- {
-28. case -1:
-29. ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p bad read\n", "client logger"), -1);
-30. case 0:
-31. ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) closing log daemon (fd = %d)\n", this->get_handle ()), -1);
-32. default:
-33. ACE_DEBUG ((LM_DEBUG, "(%P|%t) from client: %s",buf));
- }
-
-34. return 0;
- }
-
-35. virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg)
- {
-36. ACE_ASSERT (arg == this);
-37. ACE_DEBUG ((LM_DEBUG, "(%P|%t) handling timeout from this = %u\n", this));
-38. return 0;
- }
-
- private:
-
-39. char peer_name_[MAXHOSTNAMELEN + 1];
-
- };
diff --git a/docs/tutorials/005a/main b/docs/tutorials/005a/main
deleted file mode 100644
index 36c67561463..00000000000
--- a/docs/tutorials/005a/main
+++ /dev/null
@@ -1,36 +0,0 @@
-1. #include "ace/Reactor.h"
-
-2. ACE_Reactor * g_reactor;
-
-3. static sig_atomic_t finished = 0;
-4. extern "C" void handler (int) { finished = 1; }
-
-5. static const u_short PORT = ACE_DEFAULT_SERVER_PORT;
-
-6. int main (int argc, char *argv[])
- {
-7. g_reactor = new ACE_Reactor;
-
- // Acceptor factory.
-8. Logging_Acceptor peer_acceptor;
-
-9. if (peer_acceptor.open (ACE_INET_Addr (PORT)) == -1)
-10. ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
-
-11. else if (g_reactor->register_handler (&peer_acceptor, ACE_Event_Handler::READ_MASK) == -1)
-12. ACE_ERROR_RETURN ((LM_ERROR, "registering service with ACE_Reactor\n"), -1);
-
-13. ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
-
- // Run forever, performing logging service.
-
-14. ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting up server logging daemon\n"));
-
- // Perform logging service until QUIT_HANDLER receives SIGINT.
-15. while ( !finished )
-16. g_reactor->handle_events ();
-
-17. ACE_DEBUG ((LM_DEBUG, "(%P|%t) shutting down server logging daemon\n"));
-
-18. return 0;
- }
diff --git a/docs/tutorials/005a/main.cpp b/docs/tutorials/005a/main.cpp
deleted file mode 100644
index 76489b67452..00000000000
--- a/docs/tutorials/005a/main.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// $Id$
-#include "ace/Reactor.h"
-ACE_Reactor * g_reactor;
-
-static sig_atomic_t finished = 0;
-class Logging_Handler;
-
-extern "C" void handler (int) { finished = 1; }
-static void *thread_run(void *);
-
-static const u_short PORT = ACE_DEFAULT_SERVER_PORT;
-
-int main (int argc, char *argv[])
-{
- g_reactor = new ACE_Reactor;
-
- Logging_Acceptor peer_acceptor;
-
- if (peer_acceptor.open (ACE_INET_Addr (PORT)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
-
- else if (g_reactor->register_handler (&peer_acceptor, ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "registering service with ACE_Reactor\n"), -1);
-
- ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting up server logging daemon\n"));
-
- while ( !finished )
- g_reactor->handle_events ();
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) shutting down server logging daemon\n"));
- return 0;
-}
diff --git a/docs/tutorials/005a/page01.html b/docs/tutorials/005a/page01.html
deleted file mode 100644
index b1f299d021b..00000000000
--- a/docs/tutorials/005a/page01.html
+++ /dev/null
@@ -1,59 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
- <TITLE>ACE Tutorial 002</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.0Gold (Win95; I) [Netscape]">
- <META NAME="Author" CONTENT="James CE Johnson">
- <META NAME="Description" CONTENT="A first step towards using ACE productively">
-</HEAD>
-<BODY text = "#000000" link="#000fff" vlink="#ff0f0f" bgcolor="#ffffff">
-
-
-<CENTER><P><B><FONT SIZE=+2>ACE&nbsp;Tutorial 005<BR>
-Creating a Multithreaded Server</FONT></B></P></CENTER>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<P>In this tutorial, we will build a little on what we learned in the previous
-tutorials and add a few extras. The end result of the tutorial will be
-a multi-threaded server which will handle large volume of connections more
-efficiently.</P>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<P>To begin, let's ask ourselves the same thing we did at the beginning
-of tutorial 001:</P>
-
-<UL>
-<P>What do you need to create a server?</P>
-</UL>
-
-<OL>
-<OL>
-<LI>Something which accepts connections from clients</LI>
-
-<LI>Something which handles established connections</LI>
-
-<LI>A main program loop that handles it all</LI>
-</OL>
-</OL>
-
-<P>Previously, we created a solution which addressed each one of these
-questions specifically. However, this solution was based on one thread
-of program flow which doesnt extract the full potential of a multi-processing
-machine like LINUX or Windows95. This tutorial specifically addresses this
-issue and examines how to use multiple threads , each handling a seperate
-connection. We will start by examining a solution which uses the ACE package
-to spawn threads, and then I will introduce an alternative solution based
-on the active object paradigm. On we go...</P>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<CENTER><P>[<A HREF="..">Tutorial Index</A>] [<A HREF="page02.html">Continue
-This Tutorial</A>] </P></CENTER>
-
-</BODY>
-</HTML>
diff --git a/docs/tutorials/005a/page02.html b/docs/tutorials/005a/page02.html
deleted file mode 100644
index e6698741fae..00000000000
--- a/docs/tutorials/005a/page02.html
+++ /dev/null
@@ -1,178 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
- <TITLE>ACE Tutorial 001</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.0Gold (Win95; I) [Netscape]">
- <META NAME="Author" CONTENT="James CE Johnson">
- <META NAME="Description" CONTENT="A first step towards using ACE productively">
-</HEAD>
-<BODY text = "#000000" link="#000fff" vlink="#ff0f0f" bgcolor="#ffffff">
-
-
-<CENTER><P><B><FONT SIZE=+2>ACE&nbsp;Tutorial 005<BR>
-Creating a MulitThreaded Server </FONT></B></P></CENTER>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<P>The program is actually small enough to fit into a single source file.
-To make things a little easier to follow, though, I've broken it up into
-three parts: <TT>main, acceptor and handler</TT>. Each is presented with
-line numbers and description. Because it is a single file, you won't see
-<I>#include</I> directives you may expect. Wait 'till the final page and
-see the whole thing put together before you worry about things like that.</P>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<P>We begin by looking at the main portion program:</P>
-
-<UL>
-<PRE>
-
-1. ACE_Reactor * g_reactor;
-
-2. static sig_atomic_t finished = 0;
-
-3. class Logging_Handler;
-
-4. extern &quot;C&quot; void handler (int) { finished = 1; }
-5. static void *thread_run(void *);
-
-6. static const u_short PORT = ACE_DEFAULT_SERVER_PORT;
-
-7. int main (int argc, char *argv[])
- {
-8. g_reactor = new ACE_Reactor;
-
-9. Logging_Acceptor peer_acceptor;
-
-10. if (peer_acceptor.open (ACE_INET_Addr (PORT)) == -1)
-11. ACE_ERROR_RETURN ((LM_ERROR, &quot;%p\n&quot;, &quot;open&quot;), -1);
-
-12. else if (g_reactor-&gt;register_handler (&amp;peer_acceptor, ACE_Event_Handler::READ_MASK) == -1)
-13. ACE_ERROR_RETURN ((LM_ERROR, &quot;registering service with ACE_Reactor\n&quot;), -1);
-
-14. ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
-
-15. ACE_DEBUG ((LM_DEBUG, &quot;(%P|%t) starting up server logging daemon\n&quot;));
-
-16. while ( !finished )
-17. g_reactor-&gt;handle_events ();
-
-18. ACE_DEBUG ((LM_DEBUG, &quot;(%P|%t) shutting down server logging daemon\n&quot;));
-
-19. return 0;
- }
-
-</PRE>
-</UL>
-
-<P>
-<HR></P>
-
-<OL>
-<LI>To keep things simple, we again have a global reactor object. This
-time, however, we are keeping a pointer to it. Since C++&nbsp;isn't too
-clear about initialization of global/static objects I chose to dynamically
-create the object in <I>main</I> rather than having it global.</LI>
-
-<LI><I>finished</I> is an atomic data type which we will use to tell us
-the server should exit. It will be set when the program receives an <I>interrupt</I>
-signal.</LI>
-
-<LI>Declare the class Logging_Handler, so that we can declare it as a friend
-class in our derived Reactor object. This is necessary because we need
-access to the counter in the derived reactors private variable space.</LI>
-
-<LI>This &quot;C&quot; function will process the <I>interrupt</I> signal
-if it is received by the program. All that it needs to do is set the <I>finished</I>
-flag which our main loop will look at as an indication to exit.</LI>
-
-<LI>Declare the function prototype for the thread entry point. This is
-the function where the thread starts running in, hence it is declared static
-so the address of the function can be used to pass to the thread. Note
-that we can pass one argument into the thread - we will use this to pass
-the service handler object into the thread so it has a reference to the
-object which called it.</LI>
-
-<LI>The simple variable <I>PORT</I> is statically initialized to a default
-value. This is where the server will listen for new client connection requests.</LI>
-
-<LI>A typical <I>main</I> signature. Although we give ourselves access
-to the command-line arguments, we won't be using them. A more robust example
-might allow specifying the port number or other information via the command-line.</LI>
-
-<LI>The global reactor pointer is now initialized. We could have just as
-easily have chosen to create it on the stack and set <I>g_reactor</I> to
-point to the stack variable. Either way, it gives us more control than
-declaring it outside of <I>main</I>.</LI>
-
-<LI>Now, we create the object which will accept new client requests. Unlike
-the reactor, we did create this one on the stack. In the long run it really
-doesn't matter since Unix is very nice about cleaning up allocated memory
-when the program exits.</LI>
-
-<LI>We now use the acceptor's <I>open</I> member function to get it up
-and running. We create the object of type ACE_INET_addr with the port number
-as the argument and pass this object into the open function. ACE wrapper
-now take care of the low level details of preparing the port for incoming
-data , and we are now ready to register the acceptor object with the reactor
-to start accepting requests.</LI>
-
-<LI>We use <I>ACE_ERROR_RETURN</I> to get ourselves out if the <I>open</I>
-call fails. This is a handy and consistent method for reporting nasty things.</LI>
-
-<LI>If the <I>open</I> was successful we will get to here. It is now time
-to register the acceptor with the reactor so that the acceptor's member
-functions will be called when there is activity to be dealt with. Notice
-that we have to pass the address of the acceptor since we created the object
-on the stack instead of with <I>new</I>. Also notice that we're asking
-the reactor to only respond to <I>READ</I> type events. These will be client
-connection requests.</LI>
-
-<LI>Another call to <I>ACE_ERROR_RETURN</I> if the registration failed.</LI>
-
-<LI>An <I>ACE_Sig_Action</I> object is created and given the address of
-the <I>handle</I> &quot;C&quot;&nbsp;function declared above. With that
-function is associated the signal <I>SIGINT</I>. If the program receives
-this signal at any time, the <I>handle</I> function will be called. This
-is our way to cleanly exit the program. There is a much cleaner way to
-do this by creating an object which is registered with the reactor. However,
-I&nbsp;don't want to get into reactor-registered signal handlers at this
-time, so we're going with the easy-out.</LI>
-
-<LI><I>ACE_DEBUG</I> is another function like <I>ACE_ERROR_RETURN</I> that
-we can use to provide consistent messages to the user. Here, we just want
-to report that the program has started.</LI>
-
-<LI>Loop forever unless <I>finished</I> gets a non-zero value. Since the
-only way that can happen is by receipt of an <I>interrupt</I> signal, we
-will keep running until somebody <I>kill</I>s us with that (<I>kill -SIGINT&nbsp;process-id</I>).</LI>
-
-<LI>As always, allow the reactor to handle any events that are generated
-on it's registered event handlers.</LI>
-
-<LI>Announce our departure.</LI>
-
-<LI>Return a successful exit value to the operating system.</LI>
-</OL>
-
-<P>We got a little sloppy by not <I>delete</I>ing the reactor we dynamically
-allocated at the beginning of <I>main</I>. We really should do that for
-sake of completeness and neat programming. Even if we forget though, Unix
-is good about freeing up a program's memory (automatic and dynamically
-allocated)&nbsp;when the program exits.</P>
-
-<P>When compared with our last tutorial, this <TT>main</TT> portion of
-the server has changed very little in our conversion to a multi threaded
-server. Next, we will create our acceptor object which is used in <TT>main.</TT></P>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<CENTER><P>[<A HREF="../../Tutorial">Tutorial Index</A>] [<A HREF="page01.html">Previous
-Page</A>] [<A HREF="page03.html">Continue This Tutorial</A>] </P></CENTER>
-
-</BODY>
-</HTML>
diff --git a/docs/tutorials/005a/page03.html b/docs/tutorials/005a/page03.html
deleted file mode 100644
index b68851b7a6e..00000000000
--- a/docs/tutorials/005a/page03.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
- <TITLE>ACE Tutorial 001</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.0Gold (Win95; I) [Netscape]">
- <META NAME="Author" CONTENT="James CE Johnson">
- <META NAME="Description" CONTENT="A first step towards using ACE productively">
-</HEAD>
-<BODY text = "#000000" link="#000fff" vlink="#ff0f0f" bgcolor="#ffffff">
-
-
-<CENTER><P><B><FONT SIZE=+2>ACE&nbsp;Tutorial 005<BR>
-Creating a MultiThreaded Server </FONT></B></P></CENTER>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<P>This is what we do to create an acceptor from the ACE&nbsp;template:</P>
-
-<UL>
-<PRE>
-1. #include &quot;ace/Acceptor.h&quot;
-2. #include &quot;ace/SOCK_Acceptor.h&quot;
-
-3. typedef ACE_Acceptor &lt;Logging_Handler, ACE_SOCK_ACCEPTOR&gt; Logging_Acceptor;
-</PRE>
-</UL>
-
-<P>
-<HR></P>
-
-<P>Now, if you think that was difficult, you may as well give up now.</P>
-
-<OL>
-<LI>The <I>Acceptor</I> header file defines the template we're about to
-use. This is a totally generic object where all of the hard work as already
-been done.</LI>
-
-<LI>Because we want to accept connections on an <I>ACE_SOCK_Stream</I>,
-we have to pull in this header. It provides the API details that we will
-need.</LI>
-
-<LI>Finally, create a <I>Logging_Acceptor</I> object based on the <I>ACE_Acceptor</I>
-template. The first parameter <I>Logging_Handler</I> is an object we will
-develop on the next page. This object will be created by the template-generated
-code whenever a new connection request is accepted. The second parameter
-tells the template what kind of acceptor to create. It is most important
-that the first-parameter object and the second parameter be consistent
-in the connetion types used.</LI>
-</OL>
-
-<P>Obviously we're doing things a bit out of order here: <I>main</I> won't
-be happy until it knows what a <I>Logging_Acceptor</I> is and the acceptor
-won't be happy until it knows what a <I>Logging_Handler</I> is. The next
-page pulls in this last definition for us and after that we tie it all
-together.</P>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<CENTER><P>[<A HREF="../../Tutorial">Tutorial Index</A>] [<A HREF="page02.html">Previous
-Page</A>] [<A HREF="page04.html">Continue This Tutorial</A>] </P></CENTER>
-
-</BODY>
-</HTML>
diff --git a/docs/tutorials/005a/page04.html b/docs/tutorials/005a/page04.html
deleted file mode 100644
index 6f75aeca698..00000000000
--- a/docs/tutorials/005a/page04.html
+++ /dev/null
@@ -1,274 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
- <TITLE>ACE Tutorial 001</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.0Gold (Win95; I) [Netscape]">
- <META NAME="Author" CONTENT="James CE Johnson">
- <META NAME="Description" CONTENT="A first step towards using ACE productively">
-</HEAD>
-<BODY text = "#000000" link="#000fff" vlink="#ff0f0f" bgcolor="#ffffff">
-
-
-<CENTER><P><B><FONT SIZE=+2>ACE&nbsp;Tutorial 005<BR>
-Creating a MultiThreaded Server </FONT></B></P></CENTER>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<P>The final piece in our multi-threaded server is the <I>Logging_Handler</I>
-class.&nbsp;As you might guess, this is the part has been modified most
-from our previous server to include threads. This is a perfect demonstration
-of the decoupling effect of using the acceptor/connector model, whereby
-the connection oriented code is seperated from the actual processing which
-occurs after the connection has been established. :</P>
-
-<UL>
-<PRE>1. class Logging_Handler : public ACE_Svc_Handler&lt;ACE_SOCK_STREAM, ACE_NULL_SYNCH&gt;
- {
-
- public:
-
-2. Logging_Handler (void) { };
-
-3. virtual void destroy (void)
- {
-4. if (this-&gt;thread_reactorP-&gt;remove_handler(this,
- ACE_Event_Handler::READ_MASK | ACE_Event_Handler::DONT_CALL) == -1)
-5. ACE_ERROR_RETURN ((LM_ERROR, &quot;can'(%P|%t) t remove service from reactor\n&quot;), -1);
-
- // Decrement the handler tracking variable in the reactor to
- // indicate this service handler has terminated
-6. --thread_reactorP-&gt;counter;
-
-7. this-&gt;peer ().close ();
-8. delete this;
- }
-
-11. static void *run_thread(Logging_Handler *this_)
- {
-12. Reactor_Derived thread_reactor;
-
-13. this_-&gt;thread_reactorP = &amp;thread_reactor;
-
- // Increment our handler counter to account for this service handler
-14. ++thread_reactor.counter;
-
-15. if (thread_reactor.register_handler(this_, ACE_Event_Handler::READ_MASK) == -1)
-16. ACE_ERROR_RETURN ((LM_ERROR,&quot;can'(%P|%t) t register with reactor\n&quot;), -1);
-
-17. while( thread_reactor.counter &gt; 0 )
- {
- // If thread_reactor.counter = 0 then we have no more service
- // handlers connected to the reactor. We set a timeout value
- // of 1 second so that the handle_events loop break out every
- // second to check on the count ( because of it blocking
- // even when there are no connections we need to do this)
-18. thread_reactor.handle_events(ACE_Time_Value(1,0));
- }
- }
-
-19. virtual int open (void *)
- {
-20. ACE_Thread::spawn(&amp;Logging_Handler::run_thread,this);
-21. return 0;
- }
-
-22. virtual int close (u_long)
- {
-23. this-&gt;destroy ();
-24. return 0;
- }
-
- protected:
-
-25. virtual int handle_input (ACE_HANDLE)
- {
-26. char buf[128];
-27. memset(buf,0,sizeof(buf));
-
-28. switch( this-&gt;peer().recv(buf,sizeof buf) )
- {
-29. case -1:
-30. ACE_ERROR_RETURN ((LM_ERROR, &quot;(%P|%t) %p bad read\n&quot;, &quot;client logger&quot;), -1);
-31. case 0:
-32. ACE_ERROR_RETURN ((LM_ERROR, &quot;(%P|%t) closing log daemon (fd = %d)\n&quot;, this-&gt;get_handle ()), -1);
-33. default:
-34. ACE_DEBUG ((LM_DEBUG, &quot;(%P|%t) from client : %s&quot;,buf)); </PRE>
-
-<PRE> }
-
-35. return 0;
- }
-
-
- private:
-36. Reactor_Derived *thread_reactorP;
-
- };
-
-</PRE>
-</UL>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<P>Here's the step-by-step explanation:</P>
-
-<OL>
-<LI>We've apparently decided to be bold and use yet another ACE template
-to create our <I>Logging_Handler</I> object. From the manual, the <I>ACE_Svc_Handler</I>
-template <I>defines the interface for a service that exchanges data with
-its connected peer</I>. The first template argument specifies the kind
-of connection we want to have. As mentioned on the previous page, this
-<B>must</B> be compatible with the data type used to accept the connection.
-As for the second argument, I have no idea. Somebody please explain this
-to me.</LI>
-
-<LI>Our default constructor does nothing. We've moved anything with failure
-potential into the <I>open</I> function. Should the constructor be virtual?</LI>
-
-<LI>destroy() is called by our close function which is called when the
-service handler needs to be cleaned up due to termination</LI>
-
-<LI>Unregister the <I>Logging_Handler</I> object (this) from the reactor
-which is associated with this <I>Logging_Handler</I> object. The reactor
-address is got by dereferencing the pointer (thread_reactor_P in this case)
-which is the pointer to the local reactor object. We pass in two flags
-to the remove_handler call, because the <I>Logging_Handler</I> was registered
-in read mode and therefore needs to be unregistered in the same manner.
-The flag DONT_CALL tells the reactor not to callback on the remove_handler
-function ???!</LI>
-
-<LI>If this is called an error has occured while unregistering the <I>Logging_Handler</I>
-object so generate an error.</LI>
-
-<LI>Decrement the counter for the reactor which is associated with this
-<I>Logging_Handler</I>. This indicates that another connection has gone
-away and the reactor's main loop (handle_events) will not loop any more.
-Since we are only using one connecter per reactor , this is not really
-necessary in this tutorial , and our next tutorial will use this idea for
-multiple connections per reactor.</LI>
-
-<LI>Close the connection to the client. Notice that we use the <I>peer()</I>
-member function generated by the template. We should never need direct
-access to the actual connection object.</LI>
-
-<LI>Delete the current Logging_Handler object from memory - This is necessary
-because memory has been dynamically allocated so it wont clean up automatically
-when the scope of a function runs out.</LI>
-
-<LI>Out thread entry point. This is the function that is called when a
-service_handler spawns off a thread to handle a specific question. Note
-it accepts a pointer to an object of type Logging_Handler. This is necessary
-since the function is static so it is shared among all of the instantiated
-objects of type Logging_Handler, and we need a reference to the object
-we are dealing with at run time.</LI>
-
-<LI>Sets up the pointer to point to our automatic variable thread_reactor.
-This ensures that the memory used to hold the thread reactor is removed
-when it goes out of scope.</LI>
-
-<LI>Register the Logging_Handler with the local reactor. Note how the flag
-READ_MASK is passed in to indicate that the Logging_Handler object is expecting
-input of data.</LI>
-
-<LI>An error has occurred while registering in the handle (register_hanler
-returned -1) so register an error using ACE_ERROR_RETURN predefined function
-call to handle error(write standard error,etc.)</LI>
-
-<LI>Increment the counter which is our tracking variable for the number
-of connections that the reactor is handling. As this tutorial has only
-one connection per reactor it is not really necessary here , but the concept
-will be used to handle multiple connections per reactor in the next tutorial.
-</LI>
-
-<LI>Loop while connections still are registered in the local reactor. The
-counter variable is used to hold the number of registered connections in
-the reactor. As this tutorial spawns a new thread for each connection ,
-each reactor will have only one connection registered with it. In this
-tutorial we could just exit when the connection is terminated, but as we
-will see in the next tutorial, multiple connections per reactor will be
-implemented to allow proper load balancing. </LI>
-
-<LI>Call the handle_events function which iterated through all of its registered
-connection handlers and checks for input. Note that we use the ACE_Time_Value
-class to set a time out of 1 second. This breaks out of blocking mode so
-that the number of connections can be checked again . A bug in ACE whereby
-it blocks on a reactor even if no connections are present ?</LI>
-
-<LI>The <I>open</I> function contains all of our initialization logic.
-It is called by the acceptor when a new connection is accepted. If we fail
-to initialize for any reason, we will return an error code so that the
-acceptor can respond correctly. This could not be done in a constructor.</LI>
-
-<LI>Spawn off a thread to handle this connection handler. The name of the
-function called is specifed as the first parameter, which in this case
-is the static function run_thread. The thread then starts running at the
-function run_thread. Note also we need a reference to what connection handle
-we are referring to at run time (the this variable).</LI>
-
-<LI>Return 0 indicating success with the open function.</LI>
-
-<LI>Close() is called by the reactor when the connection handler should
-terminate.</LI>
-
-<LI>Call the destroy function which cleans up the connection handler (unregisters
-the reactor handles and deletes memory references..etc..)</LI>
-
-<LI>Return 0 to indicate success so we can continue running</LI>
-
-<LI><I>handle_input</I> is where you do whatever your application requires
-when data is received from the client system.</LI>
-
-<LI>Create a storage space for the received data</LI>
-
-<LI>and make sure it is empty.</LI>
-
-<LI>Receive as much data as we can but don't overrun our buffer. For this
-simple example, we don't get too fancy. In a real application we would
-probably read some number of bytes (4?) and create a number from them.
-We would then use that number to decide how many more bytes to read. The
-number could be a simple byte count or it could be a packet type indicator
-which implies a bytecount.</LI>
-
-<LI>If <I>recv</I> returns <I>-1</I> then there is something bad wrong
-with the connection so</LI>
-
-<LI>we return an <I>-1</I> to the reactor along with a failure message.
-We cannot continue after this.</LI>
-
-<LI>A <I>0</I> return from <I>recv</I> is not quite so bad. However, <I>handle_input</I>
-wouldn't have been called if there was no data to be read. So, we take
-this to be a sign that the client chose to shutdown the connection.</LI>
-
-<LI>Like the case above, we need to return a <I>-1</I> to the reactor so
-that we can be shutdown. </LI>
-
-<LI>Any other value from <I>recv</I> is taken to indicate the number of
-bytes received so</LI>
-
-<LI>we display the data to the user. In the real world, we could do an
-infinite number of things with the data.</LI>
-
-<LI>Return <I>0</I> if all is well with the receive so that the reactor
-will allow us to continue functioning.</LI>
-
-<LI>Declare the pointer which will store the address of the reactor associated
-with each connection handler. Each connection handler will have one of
-these.</LI>
-</OL>
-
-<P>Obviously this is a bit more complicated than the rest of the program.
-Still, you see there isn't a lot of networking knowlege needed to get this
-up and going. There are unfortunately several questions that I can't answer
-(such as the <I>delete this</I> issue) but given time, I'm sure we'll all
-figure it out.</P>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<CENTER><P>[<A HREF="..">Tutorial Index</A>] [<A HREF="page03.html">Previous
-Page</A>] [<A HREF="page05.html">Continue This Tutorial</A>] </P></CENTER>
-
-</BODY>
-</HTML>
diff --git a/docs/tutorials/005a/page04a.html b/docs/tutorials/005a/page04a.html
deleted file mode 100644
index c9ca8e50ede..00000000000
--- a/docs/tutorials/005a/page04a.html
+++ /dev/null
@@ -1,97 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
- <TITLE>ACE Tutorial 001</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.0Gold (Win95; I) [Netscape]">
- <META NAME="Author" CONTENT="James CE Johnson">
- <META NAME="Description" CONTENT="A first step towards using ACE productively">
-</HEAD>
-<BODY text = "#000000" link="#000fff" vlink="#ff0f0f" bgcolor="#ffffff">
-
-
-<CENTER><P><B><FONT SIZE=+2>ACE&nbsp;Tutorial 005<BR>
-Creating a MultiThreaded Server </FONT></B></P></CENTER>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<P>Since each Logging_Handler has a reactor, we could implement multiple
-connections per reactor. To do this we need some mechanism for tracking
-the number of connections that are associated with a particular reactor.
-We can achieve this by deriving a class from base class ACE_Reactor and
-holding a private variable associated with the derived object. This will
-be incremented and decremented as client connections are added and deleted
-respectively. I know this mechanism is crude ..... but show me another
-way of doing it !! The dervied class definition is as follows : </P>
-
-<UL>
-<PRE>1. class Reactor_Derived : public ACE_Reactor
- {
-
- public :
-2. Reactor_Derived() : ()
- {
-3. counter = 0;
- }
-
-4. virtual ~Reactor_Derived()
- {
-
- }
-
- private :
-5. friend class Logging_Handler;
-
- // counter is used to keep track of the number of service handlers
- // registered with this reactor (Surely theres a better way ;-)
-6. int counter;
- };
-
-
-</PRE>
-</UL>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<P>Here's the step-by-step explanation:</P>
-
-<OL>
-<LI>Declaration for the subclassed-reactor which is derived from the ACE_Reactor
-base class</LI>
-
-<LI>Constructor for our subclassed-reactor. Notice the empty parentheses
-- This calls the parent class constructor.</LI>
-
-<LI>Set our connection counter variable to 0.</LI>
-
-<LI>Our default constructor does nothing. We've moved anything with failure
-potential into the <I>open</I> function. Should the constructor be virtual?</LI>
-
-<LI>Declare the Logging_Handler class to be a friend class of this object.
-This allows the Logging_Handler class to access our private connection
-counter variable , allowing it to detect when all of our connections have
-been terminated for this reactor object.</LI>
-
-<LI>Our private counter variable which is used to count the number of connections
-registered with this reactor. </LI>
-
-<P>Now that the special reactor has been defined, we will define the final
-class in our multi-threaded server, the Logging_Handler.</P>
-
-<OL>
-<OL>
-<OL>
-<OL>
-<OL>
-<P>[<A HREF="..">Tutorial Index</A>] [<A HREF="page03.html">Previous Page</A>]
-[<A HREF="page05.html">Continue This Tutorial</A>] </P>
-</OL>
-</OL>
-</OL>
-</OL>
-</OL>
-</OL>
-
-</BODY>
-</HTML>
diff --git a/docs/tutorials/005a/page05.html b/docs/tutorials/005a/page05.html
deleted file mode 100644
index c9ca8e50ede..00000000000
--- a/docs/tutorials/005a/page05.html
+++ /dev/null
@@ -1,97 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
- <TITLE>ACE Tutorial 001</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.0Gold (Win95; I) [Netscape]">
- <META NAME="Author" CONTENT="James CE Johnson">
- <META NAME="Description" CONTENT="A first step towards using ACE productively">
-</HEAD>
-<BODY text = "#000000" link="#000fff" vlink="#ff0f0f" bgcolor="#ffffff">
-
-
-<CENTER><P><B><FONT SIZE=+2>ACE&nbsp;Tutorial 005<BR>
-Creating a MultiThreaded Server </FONT></B></P></CENTER>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<P>Since each Logging_Handler has a reactor, we could implement multiple
-connections per reactor. To do this we need some mechanism for tracking
-the number of connections that are associated with a particular reactor.
-We can achieve this by deriving a class from base class ACE_Reactor and
-holding a private variable associated with the derived object. This will
-be incremented and decremented as client connections are added and deleted
-respectively. I know this mechanism is crude ..... but show me another
-way of doing it !! The dervied class definition is as follows : </P>
-
-<UL>
-<PRE>1. class Reactor_Derived : public ACE_Reactor
- {
-
- public :
-2. Reactor_Derived() : ()
- {
-3. counter = 0;
- }
-
-4. virtual ~Reactor_Derived()
- {
-
- }
-
- private :
-5. friend class Logging_Handler;
-
- // counter is used to keep track of the number of service handlers
- // registered with this reactor (Surely theres a better way ;-)
-6. int counter;
- };
-
-
-</PRE>
-</UL>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<P>Here's the step-by-step explanation:</P>
-
-<OL>
-<LI>Declaration for the subclassed-reactor which is derived from the ACE_Reactor
-base class</LI>
-
-<LI>Constructor for our subclassed-reactor. Notice the empty parentheses
-- This calls the parent class constructor.</LI>
-
-<LI>Set our connection counter variable to 0.</LI>
-
-<LI>Our default constructor does nothing. We've moved anything with failure
-potential into the <I>open</I> function. Should the constructor be virtual?</LI>
-
-<LI>Declare the Logging_Handler class to be a friend class of this object.
-This allows the Logging_Handler class to access our private connection
-counter variable , allowing it to detect when all of our connections have
-been terminated for this reactor object.</LI>
-
-<LI>Our private counter variable which is used to count the number of connections
-registered with this reactor. </LI>
-
-<P>Now that the special reactor has been defined, we will define the final
-class in our multi-threaded server, the Logging_Handler.</P>
-
-<OL>
-<OL>
-<OL>
-<OL>
-<OL>
-<P>[<A HREF="..">Tutorial Index</A>] [<A HREF="page03.html">Previous Page</A>]
-[<A HREF="page05.html">Continue This Tutorial</A>] </P>
-</OL>
-</OL>
-</OL>
-</OL>
-</OL>
-</OL>
-
-</BODY>
-</HTML>
diff --git a/docs/tutorials/005a/page06.html b/docs/tutorials/005a/page06.html
deleted file mode 100644
index 2e5cde0ac9b..00000000000
--- a/docs/tutorials/005a/page06.html
+++ /dev/null
@@ -1,42 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<HTML>
-<HEAD>
- <TITLE>ACE Tutorial 001</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.0Gold (Win95; I) [Netscape]">
- <META NAME="Author" CONTENT="James CE Johnson">
- <META NAME="Description" CONTENT="A first step towards using ACE productively">
-</HEAD>
-<BODY text = "#000000" link="#000fff" vlink="#ff0f0f" bgcolor="#ffffff">
-
-
-<CENTER><P><B><FONT SIZE=+2>ACE&nbsp;Tutorial 005<BR>
-Creating a MultiThreaded Server </FONT></B></P></CENTER>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<P>Well, that's it for the first section of the fifth tutorial. Doug Schmidt
-proposed a more &quot;elegant&quot; way to implement a multi-threaded server
-by using active objects. We will discuss this solution next as a carry
-on to tutorial five, even though the solution doesnt allow for multiple
-connections per reactor object. Click on &quot;Alternative solution&quot;
-below to carry on with tutorial five....</P>
-
-<P>As promised, this all fits together into a single file (server.cpp)</P>
-
-<UL>
-<LI><A HREF="00SetEnv">Environment Settings</A></LI>
-
-<LI><A HREF="Makefile">Makefile</A></LI>
-
-<LI><A HREF="server.cpp">server.cpp</A></LI>
-</UL>
-
-<P>
-<HR WIDTH="100%"></P>
-
-<CENTER><P>[<A HREF="..">Tutorial Index</A>] [<A HREF="page03.html">Previous
-Page</A>] [<A HREF="file://page5b.html">Alternative Solution]</A> </P></CENTER>
-
-</BODY>
-</HTML>
diff --git a/docs/tutorials/005a/server b/docs/tutorials/005a/server
deleted file mode 100644
index 6aa3533662b..00000000000
--- a/docs/tutorials/005a/server
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/005a/server.bck b/docs/tutorials/005a/server.bck
deleted file mode 100644
index 03f05b5903a..00000000000
--- a/docs/tutorials/005a/server.bck
+++ /dev/null
@@ -1,160 +0,0 @@
-
-#include "ace/Acceptor.h"
-#include "ace/SOCK_Acceptor.h"
-#include "ace/Reactor.h"
-#include "ace/Thread.h"
-
-
-ACE_Reactor * g_reactor;
-
-static sig_atomic_t finished = 0;
-
-class Logging_Handler;
-
-extern "C" void handler (int) { finished = 1; }
-static void *thread_run(void *);
-
-
-
-class Reactor_Derived : public ACE_Reactor
-{
-
-public :
- Reactor_Derived() : ()
- {
- counter = 0;
- }
-
- virtual ~Reactor_Derived()
- {
- cout << "*****Calling the reactor destructor*****" << endl;
- }
-
-private :
- friend class Logging_Handler;
-
- // counter is used to keep track of the number of service handlers
- // registered with this reactor (Surely theres a better way ;-)
- int counter;
-};
-
-class Logging_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
-{
-
-public:
-
- Logging_Handler (void) { };
-
- virtual void destroy (void)
- {
- if (this->thread_reactorP->remove_handler(this,
- ACE_Event_Handler::READ_MASK | ACE_Event_Handler::DONT_CALL) == -1
- )
- ACE_ERROR_RETURN ((LM_ERROR, "can'(%P|%t) t remove service from reactor\n"), -1);
-
- // Decrement the handler tracking variable in the reactor to
- // indicate this service handler has terminated
- --thread_reactorP->counter;
-
- this->peer ().close ();
- delete this;
- }
-
- static void *run_thread(Logging_Handler *this_)
- {
- Reactor_Derived thread_reactor;
-
- this_->thread_reactorP = &thread_reactor;
-
- // Increment our handler counter to account for this service handler
- ++thread_reactor.counter;
-
- if (thread_reactor.register_handler(this_, ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,"can'(%P|%t) t register with reactor\n"), -1);
-
- while( thread_reactor.counter > 0 )
- {
- // If thread_reactor.counter = 0 then we have no more service
- // handlers connected to the reactor. We set a timeout value
- // of 1 second so that the handle_events loop break out every
- // second to check on the count ( because of it blocking
- // even when there are no connections we need to do this)
- thread_reactor.handle_events(ACE_Time_Value(1,0));
- }
- }
-
- virtual int open (void *)
- {
- ACE_Thread::spawn(&Logging_Handler::run_thread,this);
- return 0;
- }
-
- virtual int close (u_long)
- {
- this->destroy ();
- return 0;
- }
-
-protected:
-
- virtual int handle_input (ACE_HANDLE)
- {
- char buf[128];
- memset(buf,0,sizeof(buf));
-
- cout << "handle_input in " << getpid() << endl;
- switch( this->peer().recv(buf,sizeof buf) )
- {
- case -1:
- ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p bad read\n", "client logger"), -1);
- case 0:
- ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) closing log daemon (fd = %d)\n", this->get_handle ()), -1);
- default:
- cout << "Data from client " << buf << endl;
- }
-
- return 0;
- }
-
-
-private:
- Reactor_Derived *thread_reactorP;
- char peer_name_[MAXHOSTNAMELEN + 1];
-
-};
-
-
-typedef ACE_Acceptor <Logging_Handler, ACE_SOCK_ACCEPTOR> Logging_Acceptor;
-
-
-static const u_short PORT = ACE_DEFAULT_SERVER_PORT;
-
-int main (int argc, char *argv[])
-{
- g_reactor = new ACE_Reactor;
-
- cout << "main is " << getpid() << endl;
-
- // Acceptor factory.
- Logging_Acceptor peer_acceptor;
-
- if (peer_acceptor.open (ACE_INET_Addr (PORT)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
-
- else if (g_reactor->register_handler (&peer_acceptor, ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "registering service with ACE_Reactor\n"), -1);
-
- ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
-
- // Run forever, performing logging service.
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting up server logging daemon\n"));
-
- // Perform logging service until QUIT_HANDLER receives SIGINT.
- while ( !finished )
- g_reactor->handle_events ();
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) shutting down server logging daemon\n"));
-
- return 0;
-}
diff --git a/docs/tutorials/005a/server.cpp b/docs/tutorials/005a/server.cpp
deleted file mode 100644
index 70b92716f02..00000000000
--- a/docs/tutorials/005a/server.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-// $Id$
-
-#include "ace/Acceptor.h"
-#include "ace/SOCK_Acceptor.h"
-#include "ace/Reactor.h"
-#include "ace/Thread.h"
-
-
-ACE_Reactor * g_reactor;
-
-static sig_atomic_t finished = 0;
-
-
-extern "C" void handler (int) { finished = 1; }
-static void *thread_run(void *);
-// ----------------------------------------
-
-class Logging_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
-{
-
-public:
-
- Logging_Handler (void)
- {
- thread_reactor = NULL;
- }
-
- ~Logging_Handler (void)
- {
- cout << "in destructor" <<endl;
- delete thread_reactor;
- }
-
- virtual void destroy (void)
- {
- cout << " in destroy" <<endl;
- g_reactor->cancel_timer (this);
- this->peer ().close ();
- delete this;
- }
-
- static void *run_thread(Logging_Handler *this_)
- {
- cout << "run_thread in " << getpid() << endl;
-
- this_->thread_reactor = new ACE_Reactor;
-
- if (this_->thread_reactor->register_handler(this_, ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,"can'(%P|%t) t register with reactor\n"), -1);
- else if (this_->thread_reactor->schedule_timer (this_, (const void *)this_, ACE_Time_Value (2), ACE_Time_Value (2)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "can'(%P|%t) t register with reactor\n"), -1);
- else
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) connected with client \n"));
-
- while(!finished)
- this_->thread_reactor->handle_events();
-
- }
-
- virtual int open (void *)
- {
- ACE_Thread::spawn(&Logging_Handler::run_thread,this);
- return 0;
- }
-
- virtual int close (u_long)
- {
-
- if (this->thread_reactor->remove_handler(this,ACE_Event_Handler::READ_MASK | ACE_Event_Handler::DONT_CALL) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "can'(%P|%t) t remove service from reactor\n"), -1);
- this->destroy ();
- return 0;
- }
-
-protected:
-
- virtual int handle_input (ACE_HANDLE)
- {
- char buf[128];
- memset(buf,0,sizeof(buf));
-
- cout << "handle_input in " << getpid() << endl;
- switch( this->peer().recv(buf,sizeof buf) )
- {
- case -1:
- ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p bad read\n", "client logger"), -1);
- case 0:
- ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) closing log daemon (fd = %d)\n", this->get_handle ()), -1);
- default:
- cout << "Data from client " << buf << endl;
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) from client: %s",buf));
- }
-
- return 0;
- }
-
- virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg)
- {
- ACE_ASSERT (arg == this);
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) handling timeout from this = %u\n", this));
- cout << "Timout in " << getpid() << endl;
- return 0;
- }
-
-private:
- ACE_Reactor *thread_reactor;
- char peer_name_[MAXHOSTNAMELEN + 1];
-
-};
-
-
-typedef ACE_Acceptor <Logging_Handler, ACE_SOCK_ACCEPTOR> Logging_Acceptor;
-
-
-static const u_short PORT = ACE_DEFAULT_SERVER_PORT;
-
-int main (int argc, char *argv[])
-{
- g_reactor = new ACE_Reactor;
-
- cout << "main is " << getpid() << endl;
-
- // Acceptor factory.
- Logging_Acceptor peer_acceptor;
-
- if (peer_acceptor.open (ACE_INET_Addr (PORT)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
-
- else if (g_reactor->register_handler (&peer_acceptor, ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "registering service with ACE_Reactor\n"), -1);
-
- ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
-
- // Run forever, performing logging service.
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting up server logging daemon\n"));
-
- // Perform logging service until QUIT_HANDLER receives SIGINT.
- while ( !finished )
- g_reactor->handle_events ();
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) shutting down server logging daemon\n"));
-
- return 0;
-}
diff --git a/docs/tutorials/005a/server.dyn b/docs/tutorials/005a/server.dyn
deleted file mode 100644
index 1baceaf64f5..00000000000
--- a/docs/tutorials/005a/server.dyn
+++ /dev/null
@@ -1,144 +0,0 @@
-
-1. #include "ace/Acceptor.h"
-2. #include "ace/SOCK_Acceptor.h"
-3. #include "ace/Reactor.h"
-4. #include "ace/Thread.h"
-
-
-5. ACE_Reactor * g_reactor;
-
-6. static sig_atomic_t finished = 0;
-
-
-7. extern "C" void handler (int) { finished = 1; }
-8. static void *thread_run(void *);
- // ----------------------------------------
-
-9. class Logging_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
- {
-
- public:
-
-10. Logging_Handler (void)
- {
-11. thread_reactor = NULL;
- }
-
-12. ~Logging_Handler (void)
- {
-13. cout << "in destructor" <<endl;
-14. delete thread_reactor;
- }
-
-15. virtual void destroy (void)
- {
-16. cout << " in destroy" <<endl;
-17. g_reactor->cancel_timer (this);
-18. this->peer ().close ();
-19. delete this;
- }
-
-20. static void *run_thread(Logging_Handler *this_)
- {
-21. cout << "run_thread in " << getpid() << endl;
-
-22. this_->thread_reactor = new ACE_Reactor;
-
-23. if (this_->thread_reactor->register_handler(this_, ACE_Event_Handler::READ_MASK) == -1)
-24. ACE_ERROR_RETURN ((LM_ERROR,"can'(%P|%t) t register with reactor\n"), -1);
-25. else if (this_->thread_reactor->schedule_timer (this_, (const void *)this_, ACE_Time_Value (2), ACE_Time_Value (2)) == -1)
-26. ACE_ERROR_RETURN ((LM_ERROR, "can'(%P|%t) t register with reactor\n"), -1);
-27. else
-28. ACE_DEBUG ((LM_DEBUG, "(%P|%t) connected with client \n"));
-
-29. while(!finished)
-30. this_->thread_reactor->handle_events();
-
- }
-
-31. virtual int open (void *)
- {
-32. ACE_Thread::spawn(&Logging_Handler::run_thread,this);
-33. return 0;
- }
-
-34. virtual int close (u_long)
- {
-
-35. if (this->thread_reactor->remove_handler(this,ACE_Event_Handler::READ_MASK | ACE_Event_Handler::DONT_CALL) == -1)
-36. ACE_ERROR_RETURN ((LM_ERROR, "can'(%P|%t) t remove service from reactor\n"), -1);
-37. this->destroy ();
-38. return 0;
- }
-
- protected:
-
-39. virtual int handle_input (ACE_HANDLE)
- {
-40. char buf[128];
-41. memset(buf,0,sizeof(buf));
-
-42. cout << "handle_input in " << getpid() << endl;
-43. switch( this->peer().recv(buf,sizeof buf) )
- {
-44. case -1:
-45. ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p bad read\n", "client logger"), -1);
-46. case 0:
-47. ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) closing log daemon (fd = %d)\n", this->get_handle ()), -1);
-48. default:
-49. cout << "Data from client " << buf << endl;
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) from client: %s",buf));
- }
-
-50. return 0;
- }
-
-51. virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg)
- {
-52. ACE_ASSERT (arg == this);
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) handling timeout from this = %u\n", this));
-53. cout << "Timout in " << getpid() << endl;
-54. return 0;
- }
-
- private:
-55. ACE_Reactor *thread_reactor;
-56. char peer_name_[MAXHOSTNAMELEN + 1];
-
- };
-
-
-57. typedef ACE_Acceptor <Logging_Handler, ACE_SOCK_ACCEPTOR> Logging_Acceptor;
-
-
-58. static const u_short PORT = ACE_DEFAULT_SERVER_PORT;
-
-59. int main (int argc, char *argv[])
- {
-60. g_reactor = new ACE_Reactor;
-
-61. cout << "main is " << getpid() << endl;
-
- // Acceptor factory.
-62. Logging_Acceptor peer_acceptor;
-
-63. if (peer_acceptor.open (ACE_INET_Addr (PORT)) == -1)
-64. ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
-
-65. else if (g_reactor->register_handler (&peer_acceptor, ACE_Event_Handler::READ_MASK) == -1)
-66. ACE_ERROR_RETURN ((LM_ERROR, "registering service with ACE_Reactor\n"), -1);
-
-67. ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
-
- // Run forever, performing logging service.
-
-68. ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting up server logging daemon\n"));
-
- // Perform logging service until QUIT_HANDLER receives SIGINT.
-69. while ( !finished )
-70. g_reactor->handle_events ();
-
-71. ACE_DEBUG ((LM_DEBUG, "(%P|%t) shutting down server logging daemon\n"));
-
-72. return 0;
- }
diff --git a/docs/tutorials/005a/server.news b/docs/tutorials/005a/server.news
deleted file mode 100644
index 51db8033c36..00000000000
--- a/docs/tutorials/005a/server.news
+++ /dev/null
@@ -1,139 +0,0 @@
-
-#include "ace/Acceptor.h"
-#include "ace/SOCK_Acceptor.h"
-#include "ace/Reactor.h"
-#include "ace/Thread.h"
-
-
-ACE_Reactor * g_reactor;
-
-static sig_atomic_t finished = 0;
-
-
-extern "C" void handler (int) { finished = 1; }
-static void *thread_run(void *);
-// ----------------------------------------
-
-class Logging_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
-{
-
-public:
-
- Logging_Handler (void)
- {
- thread_reactor = NULL;
- }
-
- ~Logging_Handler (void)
- {
- delete thread_reactor;
- }
-
- virtual void destroy (void)
- {
- g_reactor->cancel_timer (this);
- this->peer ().close ();
- delete this;
- }
-
- static void *run_thread(Logging_Handler *this_)
- {
- cout << "run_thread in " << getpid() << endl;
-
- this_->thread_reactor = new ACE_Reactor;
-
- if (this_->thread_reactor->register_handler(this_, ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) can't register with reactor\n"), -1);
- else if (this_->thread_reactor->schedule_timer (this_, (const void *)this_, ACE_Time_Value (2), ACE_Time_Value (2)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "can'(%P|%t) t register with reactor\n"), -1);
- else
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) connected with client \n"));
-
- while(!finished)
- this_->thread_reactor->handle_events();
-
- }
-
- virtual int open (void *)
- {
- ACE_Thread::spawn(&Logging_Handler::run_thread,this);
- return 0;
- }
-
- virtual int close (u_long)
- {
- this->destroy ();
- return 0;
- }
-
-protected:
-
- virtual int handle_input (ACE_HANDLE)
- {
- char buf[128];
- memset(buf,0,sizeof(buf));
-
- cout << "handle_input in " << getpid() << endl;
- switch( this->peer().recv(buf,sizeof buf) )
- {
- case -1:
- ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p bad read\n", "client logger"), -1);
- case 0:
- ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) closing log daemon (fd = %d)\n", this->get_handle ()), -1);
- default:
- cout << "Data from client " << buf << endl;
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) from client: %s",buf));
- }
-
- return 0;
- }
-
- virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg)
- {
- ACE_ASSERT (arg == this);
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) handling timeout from this = %u\n", this));
- cout << "Timout in " << getpid() << endl;
- return 0;
- }
-
-private:
- ACE_Reactor *thread_reactor;
- char peer_name_[MAXHOSTNAMELEN + 1];
-
-};
-
-
-typedef ACE_Acceptor <Logging_Handler, ACE_SOCK_ACCEPTOR> Logging_Acceptor;
-
-
-static const u_short PORT = ACE_DEFAULT_SERVER_PORT;
-
-int main (int argc, char *argv[])
-{
- g_reactor = new ACE_Reactor;
-
- cout << "main is " << getpid() << endl;
-
- // Acceptor factory.
- Logging_Acceptor peer_acceptor;
-
- if (peer_acceptor.open (ACE_INET_Addr (PORT)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
-
- else if (g_reactor->register_handler (&peer_acceptor, ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "registering service with ACE_Reactor\n"), -1);
-
- ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
-
- // Run forever, performing logging service.
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting up server logging daemon\n"));
-
- // Perform logging service until QUIT_HANDLER receives SIGINT.
- while ( !finished )
- g_reactor->handle_events ();
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) shutting down server logging daemon\n"));
-
- return 0;
-}
diff --git a/docs/tutorials/005a/serverBroken b/docs/tutorials/005a/serverBroken
deleted file mode 100644
index 21c4f5f8e7d..00000000000
--- a/docs/tutorials/005a/serverBroken
+++ /dev/null
Binary files differ
diff --git a/docs/tutorials/005a/serverBroken.cpp b/docs/tutorials/005a/serverBroken.cpp
deleted file mode 100644
index 09f446483c0..00000000000
--- a/docs/tutorials/005a/serverBroken.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-// $Id$
-
-#include "ace/Acceptor.h"
-#include "ace/SOCK_Acceptor.h"
-#include "ace/Reactor.h"
-#include "ace/Thread.h"
-
-ACE_Reactor * g_reactor;
-
-static sig_atomic_t finished = 0;
-
-extern "C" void handler (int) { finished = 1; }
-static void *thread_run(void *);
-// ----------------------------------------
-
-class Logging_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
-{
-
-public:
-
- Logging_Handler (void)
- {
- thread_reactor = NULL;
- }
-
- ~Logging_Handler (void)
- {
- cout << "in destructor";
- delete thread_reactor;
- }
-
- virtual void destroy (void)
- {
- cout << " in destroy";
- g_reactor->cancel_timer (this);
- this->peer ().close ();
- delete this;
- }
-
- static void *run_thread(Logging_Handler *this_)
- {
- cout << "run_thread in " << getpid() << endl;
-
- this_->thread_reactor = new ACE_Reactor;
-
- if (this_->thread_reactor->register_handler(this_, ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR,"can'(%P|%t) t register with reactor\n"), -1);
- else if (this_->thread_reactor->schedule_timer (this_, (const void *)this_, ACE_Time_Value (2), ACE_Time_Value (2)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "can'(%P|%t) t register with reactor\n"), -1);
- else
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) connected with client \n"));
-
- while(!finished)
- this_->thread_reactor->handle_events();
-
- }
-
- virtual int open (void *)
- {
- ACE_Thread::spawn(&Logging_Handler::run_thread,this);
- return 0;
- }
-
- virtual int close (u_long)
- {
-
- if (this->thread_reactor->remove_handler(this,ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "can'(%P|%t) t remove service from reactor\n"), -1);
- this->destroy ();
- return 0;
- }
-
-protected:
-
- virtual int handle_input (ACE_HANDLE)
- {
- char buf[128];
- memset(buf,0,sizeof(buf));
-
- cout << "handle_input in " << getpid() << endl;
- switch( this->peer().recv(buf,sizeof buf) )
- {
- case -1:
- ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) %p bad read\n", "client logger"), -1);
- case 0:
- ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) closing log daemon (fd = %d)\n", this->get_handle ()), -1);
- default:
- cout << "Data from client " << buf << endl;
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) from client: %s",buf));
- }
-
- return 0;
- }
-
- virtual int handle_timeout (const ACE_Time_Value &tv, const void *arg)
- {
- ACE_ASSERT (arg == this);
- // ACE_DEBUG ((LM_DEBUG, "(%P|%t) handling timeout from this = %u\n", this));
- cout << "Timout in " << getpid() << endl;
- return 0;
- }
-
-private:
- ACE_Reactor *thread_reactor;
- char peer_name_[MAXHOSTNAMELEN + 1];
-
-};
-
-
-typedef ACE_Acceptor <Logging_Handler, ACE_SOCK_ACCEPTOR> Logging_Acceptor;
-
-
-static const u_short PORT = ACE_DEFAULT_SERVER_PORT;
-
-int main (int argc, char *argv[])
-{
- g_reactor = new ACE_Reactor;
-
- cout << "main is " << getpid() << endl;
-
- // Acceptor factory.
- Logging_Acceptor peer_acceptor;
-
- if (peer_acceptor.open (ACE_INET_Addr (PORT)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
-
- else if (g_reactor->register_handler (&peer_acceptor, ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "registering service with ACE_Reactor\n"), -1);
-
- ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
-
- // Run forever, performing logging service.
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting up server logging daemon\n"));
-
- // Perform logging service until QUIT_HANDLER receives SIGINT.
- while ( !finished )
- g_reactor->handle_events ();
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) shutting down server logging daemon\n"));
-
- return 0;
-}