summaryrefslogtreecommitdiff
path: root/docs/tutorials/002
diff options
context:
space:
mode:
Diffstat (limited to 'docs/tutorials/002')
-rw-r--r--docs/tutorials/002/002.dsp104
-rw-r--r--docs/tutorials/002/00SetEnv2
-rw-r--r--docs/tutorials/002/Makefile52
-rw-r--r--docs/tutorials/002/combine.shar328
-rw-r--r--docs/tutorials/002/handler.h166
-rw-r--r--docs/tutorials/002/page01.html52
-rw-r--r--docs/tutorials/002/page02.html156
-rw-r--r--docs/tutorials/002/page03.html192
-rw-r--r--docs/tutorials/002/page04.html38
-rw-r--r--docs/tutorials/002/server.cpp89
10 files changed, 0 insertions, 1179 deletions
diff --git a/docs/tutorials/002/002.dsp b/docs/tutorials/002/002.dsp
deleted file mode 100644
index 2632dc42e5f..00000000000
--- a/docs/tutorials/002/002.dsp
+++ /dev/null
@@ -1,104 +0,0 @@
-# Microsoft Developer Studio Project File - Name="002" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Console Application" 0x0103
-
-CFG=002 - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE
-!MESSAGE NMAKE /f "002.mak".
-!MESSAGE
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE
-!MESSAGE NMAKE /f "002.mak" CFG="002 - Win32 Debug"
-!MESSAGE
-!MESSAGE Possible choices for configuration are:
-!MESSAGE
-!MESSAGE "002 - Win32 Release" (based on "Win32 (x86) Console Application")
-!MESSAGE "002 - Win32 Debug" (based on "Win32 (x86) Console Application")
-!MESSAGE
-
-# Begin Project
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=cl.exe
-RSC=rc.exe
-
-!IF "$(CFG)" == "002 - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\.." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 ace.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\ace"
-
-!ELSEIF "$(CFG)" == "002 - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /W3 /GX /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /GX /Od /I "..\..\.." /D "WIN32" /D "_DEBUG" /YX /FD /c
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /out:"server.exe" /pdbtype:sept /libpath:"..\..\..\ace"
-
-!ENDIF
-
-# Begin Target
-
-# Name "002 - Win32 Release"
-# Name "002 - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\server.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\handler.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# End Target
-# End Project
diff --git a/docs/tutorials/002/00SetEnv b/docs/tutorials/002/00SetEnv
deleted file mode 100644
index eca78e10c85..00000000000
--- a/docs/tutorials/002/00SetEnv
+++ /dev/null
@@ -1,2 +0,0 @@
-export ACE_ROOT=/local/src/ACE/ACE_wrappers
-export LD_LIBRARY_PATH=$ACE_ROOT/ace:$LD_LIBRARY_PATH
diff --git a/docs/tutorials/002/Makefile b/docs/tutorials/002/Makefile
deleted file mode 100644
index d5fd68fe510..00000000000
--- a/docs/tutorials/002/Makefile
+++ /dev/null
@@ -1,52 +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 $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU
-include $(ACE_ROOT)/include/makeinclude/macros.GNU
-include $(ACE_ROOT)/include/makeinclude/rules.common.GNU
-include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU
-include $(ACE_ROOT)/include/makeinclude/rules.bin.GNU
-include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
-
-#----------------------------------------------------------------------------
-# Local targets
-#----------------------------------------------------------------------------
-
-HTML : #
- [ -f hdr ] || $(MAKE) UNSHAR
- perl ../combine *.pre ; chmod +r *.html
-
-SHAR : #
- [ ! -f combine.shar ] || exit 1
- shar -T hdr bodies *.pre > combine.shar && rm -f hdr bodies *.pre *.pst
-
-UNSHAR : #
- sh combine.shar
-
-#----------------------------------------------------------------------------
-# 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/002/combine.shar b/docs/tutorials/002/combine.shar
deleted file mode 100644
index 498d2be4a46..00000000000
--- a/docs/tutorials/002/combine.shar
+++ /dev/null
@@ -1,328 +0,0 @@
-#!/bin/sh
-# This is a shell archive (produced by GNU sharutils 4.2).
-# To extract the files from this archive, save it to some FILE, remove
-# everything before the `!/bin/sh' line above, then type `sh FILE'.
-#
-# Made on 1999-01-17 14:20 EST by <jcej@chiroptera.tragus.org>.
-# Source directory was `/var/home/jcej/projects/ACE_wrappers/docs/tutorials/002'.
-#
-# Existing files will *not* be overwritten unless `-c' is specified.
-#
-# This shar contains:
-# length mode name
-# ------ ---------- ------------------------------------------
-# 607 -rw-rw-r-- hdr
-# 28 -rw-rw-r-- bodies
-# 1027 -rw-rw-r-- page01.pre
-# 1819 -rw-rw-r-- page02.pre
-# 100 -rw-rw-r-- page03.pre
-# 448 -rw-rw-r-- page04.pre
-#
-save_IFS="${IFS}"
-IFS="${IFS}:"
-gettext_dir=FAILED
-locale_dir=FAILED
-first_param="$1"
-for dir in $PATH
-do
- if test "$gettext_dir" = FAILED && test -f $dir/gettext \
- && ($dir/gettext --version >/dev/null 2>&1)
- then
- set `$dir/gettext --version 2>&1`
- if test "$3" = GNU
- then
- gettext_dir=$dir
- fi
- fi
- if test "$locale_dir" = FAILED && test -f $dir/shar \
- && ($dir/shar --print-text-domain-dir >/dev/null 2>&1)
- then
- locale_dir=`$dir/shar --print-text-domain-dir`
- fi
-done
-IFS="$save_IFS"
-if test "$locale_dir" = FAILED || test "$gettext_dir" = FAILED
-then
- echo=echo
-else
- TEXTDOMAINDIR=$locale_dir
- export TEXTDOMAINDIR
- TEXTDOMAIN=sharutils
- export TEXTDOMAIN
- echo="$gettext_dir/gettext -s"
-fi
-touch -am 1231235999 $$.touch >/dev/null 2>&1
-if test ! -f 1231235999 && test -f $$.touch; then
- shar_touch=touch
-else
- shar_touch=:
- echo
- $echo 'WARNING: not restoring timestamps. Consider getting and'
- $echo "installing GNU \`touch', distributed in GNU File Utilities..."
- echo
-fi
-rm -f 1231235999 $$.touch
-#
-if mkdir _sh00205; then
- $echo 'x -' 'creating lock directory'
-else
- $echo 'failed to create lock directory'
- exit 1
-fi
-# ============= hdr ==============
-if test -f 'hdr' && test "$first_param" != -c; then
- $echo 'x -' SKIPPING 'hdr' '(file already exists)'
-else
- $echo 'x -' extracting 'hdr' '(text)'
- sed 's/^X//' << 'SHAR_EOF' > 'hdr' &&
-<HTML>
-<HEAD>
-X <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
-X <META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (X11; I; Linux 2.0.32 i486) [Netscape]">
-X <META NAME="Author" CONTENT="James CE Johnson">
-X <META NAME="Description" CONTENT="A first step towards using ACE productively">
-X <TITLE>ACE Tutorial 002</TITLE>
-</HEAD>
-<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F">
-X
-<CENTER><B><FONT SIZE=+2>ACE Tutorial 002</FONT></B></CENTER>
-X
-<CENTER><B><FONT SIZE=+2>Creating a Better Server</FONT></B></CENTER>
-X
-X
-<P>
-<HR WIDTH="100%">
-SHAR_EOF
- $shar_touch -am 0117141599 'hdr' &&
- chmod 0664 'hdr' ||
- $echo 'restore of' 'hdr' 'failed'
- if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
- && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
- md5sum -c << SHAR_EOF >/dev/null 2>&1 \
- || $echo 'hdr:' 'MD5 check failed'
-8a98117995f511d0ed9b699587b5b6a5 hdr
-SHAR_EOF
- else
- shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'hdr'`"
- test 607 -eq "$shar_count" ||
- $echo 'hdr:' 'original size' '607,' 'current size' "$shar_count!"
- fi
-fi
-# ============= bodies ==============
-if test -f 'bodies' && test "$first_param" != -c; then
- $echo 'x -' SKIPPING 'bodies' '(file already exists)'
-else
- $echo 'x -' extracting 'bodies' '(text)'
- sed 's/^X//' << 'SHAR_EOF' > 'bodies' &&
-PAGE=2
-server.cpp
-handler.h
-SHAR_EOF
- $shar_touch -am 0117141899 'bodies' &&
- chmod 0664 'bodies' ||
- $echo 'restore of' 'bodies' 'failed'
- if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
- && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
- md5sum -c << SHAR_EOF >/dev/null 2>&1 \
- || $echo 'bodies:' 'MD5 check failed'
-9ec2171f52b5b973c247ef550fb7b035 bodies
-SHAR_EOF
- else
- shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'bodies'`"
- test 28 -eq "$shar_count" ||
- $echo 'bodies:' 'original size' '28,' 'current size' "$shar_count!"
- fi
-fi
-# ============= page01.pre ==============
-if test -f 'page01.pre' && test "$first_param" != -c; then
- $echo 'x -' SKIPPING 'page01.pre' '(file already exists)'
-else
- $echo 'x -' extracting 'page01.pre' '(text)'
- sed 's/^X//' << 'SHAR_EOF' > 'page01.pre' &&
-X
-<P>In this tutorial, we will build a little on what we learned in the first
-tutorial and add a few extras. In the end, we will have a better server
-object that is actually simpler and more maintainable than the one we created
-before.</P>
-X
-<P>
-<HR WIDTH="100%"></P>
-X
-<P>To begin, let's ask ourselves the same thing we did at the beginning
-of tutorial 001:</P>
-X
-<UL>
-<P>What do you need to create a server?</P>
-</UL>
-X
-<OL>
-<OL>
-<LI>Something which accepts connections from clients</LI>
-X
-<LI>Something which handles established connections</LI>
-X
-<LI>A main program loop that handles it all</LI>
-</OL>
-</OL>
-X
-<P>Previously, we created a solution which addressed each one of these
-questions specifically. At the end of it all, we realized that our only
-application-specific coding was confined to the <I>handler</I> portion
-of the program. We hinted that there may be a way to eliminate hand-coding
-an <I>acceptor</I> each time we want to create a server. Here, we will
-explore that approach.</P>
-X
-SHAR_EOF
- $shar_touch -am 0117141599 'page01.pre' &&
- chmod 0664 'page01.pre' ||
- $echo 'restore of' 'page01.pre' 'failed'
- if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
- && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
- md5sum -c << SHAR_EOF >/dev/null 2>&1 \
- || $echo 'page01.pre:' 'MD5 check failed'
-c5a9075793a200d7b2e49a092ee1ce6c page01.pre
-SHAR_EOF
- else
- shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'page01.pre'`"
- test 1027 -eq "$shar_count" ||
- $echo 'page01.pre:' 'original size' '1027,' 'current size' "$shar_count!"
- fi
-fi
-# ============= page02.pre ==============
-if test -f 'page02.pre' && test "$first_param" != -c; then
- $echo 'x -' SKIPPING 'page02.pre' '(file already exists)'
-else
- $echo 'x -' extracting 'page02.pre' '(text)'
- sed 's/^X//' << 'SHAR_EOF' > 'page02.pre' &&
-X
-<P>Like Tutorial 1, this is also a rather small program.&nbsp; I'm going
-to add a couple of new ideas along the way but to make up for it I'm also
-going to simplify the acceptor a great deal.
-X
-<P>
-Kirthika's Abstract:
-<UL>
-This is a server example made simpler due to the use of off-the-shelf
-components and classes from ACE.
-<P>
-Here, the Logging_Acceptor is an ACE_Acceptor class which is associated
-with the Logging_Handler and the ACE_SOCK_ACCEPTOR. This will now
-accept connection requests from the clients on being opened with the
-reactor instance passed to it.
-<P>
-We also implement a signal to capture CTRL-C [ which generates SIGINT ] using ACE_SigAction and
-ACE_SignalHandler. This signal can now be used to stop the reactor
-from handling events.
-<P>
-Then, the reactor is allowed to loop infintely until it is shut down
-using a ^C, after which both the reactor as well as the acceptor are
-destroyed.
-<P>
-The Logging_Handler derives from the ACE_Svc_Handler instead of the
-Event_Handler since the Svc_Handler has inbuilt SOCK_Stream and
-provides all the calls needed by the reactor. The Svc_Handler has the
-ability to react to events and communicate to remote tasks using the
-underlying data stream passed to it.
-<P>
-A timer is scheduled in the reactor which does nothing but simply
-display how it could be used to provide periodic processing when
-needed. The ACE_TimeValue is used to set the time period.
-<P>
-Also, optimisations have been made in the form of a separate function
-for
-destroying the objects used.
-<P>
-Thus a simpler server has now been built which successfully
-demonstrates how simple a task, writing a server can become on using
-the various ACE components judiciously.
-</UL>
-<P>We begin by looking at the <A HREF="server.cpp">main (server.cpp)</A> portion program:
-X
-<P>
-<HR WIDTH="100%">
-SHAR_EOF
- $shar_touch -am 0117141899 'page02.pre' &&
- chmod 0664 'page02.pre' ||
- $echo 'restore of' 'page02.pre' 'failed'
- if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
- && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
- md5sum -c << SHAR_EOF >/dev/null 2>&1 \
- || $echo 'page02.pre:' 'MD5 check failed'
-41fa9b0b5cced9b45407b397a57482ca page02.pre
-SHAR_EOF
- else
- shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'page02.pre'`"
- test 1819 -eq "$shar_count" ||
- $echo 'page02.pre:' 'original size' '1819,' 'current size' "$shar_count!"
- fi
-fi
-# ============= page03.pre ==============
-if test -f 'page03.pre' && test "$first_param" != -c; then
- $echo 'x -' SKIPPING 'page03.pre' '(file already exists)'
-else
- $echo 'x -' extracting 'page03.pre' '(text)'
- sed 's/^X//' << 'SHAR_EOF' > 'page03.pre' &&
-X
-<P>Now lets take a look at the new <A HREF="handler.h">Logging_Handler</A>:
-X
-<P>
-<HR WIDTH="100%">
-SHAR_EOF
- $shar_touch -am 0117141899 'page03.pre' &&
- chmod 0664 'page03.pre' ||
- $echo 'restore of' 'page03.pre' 'failed'
- if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
- && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
- md5sum -c << SHAR_EOF >/dev/null 2>&1 \
- || $echo 'page03.pre:' 'MD5 check failed'
-f62bcf39007ec332f581a0849e33fe50 page03.pre
-SHAR_EOF
- else
- shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'page03.pre'`"
- test 100 -eq "$shar_count" ||
- $echo 'page03.pre:' 'original size' '100,' 'current size' "$shar_count!"
- fi
-fi
-# ============= page04.pre ==============
-if test -f 'page04.pre' && test "$first_param" != -c; then
- $echo 'x -' SKIPPING 'page04.pre' '(file already exists)'
-else
- $echo 'x -' extracting 'page04.pre' '(text)'
- sed 's/^X//' << 'SHAR_EOF' > 'page04.pre' &&
-X
-<P>Well, that's it for the second tutorial. We've found a much easier way
-to create a server, especially the acceptor part. At the same time, we
-introduced more functionality and robustness. Not bad for a day's work.
-<BR>&nbsp;
-<UL>
-<LI>
-<A HREF="00SetEnv">Environment
-Settings</A></LI>
-X
-<LI>
-<A HREF="Makefile">Makefile</A></LI>
-X
-<LI>
-<A HREF="server.cpp">server.cpp</A></LI>
-<LI>
-<A HREF="handler.h">handler.h</A></LI>
-</UL>
-X
-SHAR_EOF
- $shar_touch -am 0117142099 'page04.pre' &&
- chmod 0664 'page04.pre' ||
- $echo 'restore of' 'page04.pre' 'failed'
- if ( md5sum --help 2>&1 | grep 'sage: md5sum \[' ) >/dev/null 2>&1 \
- && ( md5sum --version 2>&1 | grep -v 'textutils 1.12' ) >/dev/null; then
- md5sum -c << SHAR_EOF >/dev/null 2>&1 \
- || $echo 'page04.pre:' 'MD5 check failed'
-b9cf47308b8215298848b4819f6d447c page04.pre
-SHAR_EOF
- else
- shar_count="`LC_ALL= LC_CTYPE= LANG= wc -c < 'page04.pre'`"
- test 448 -eq "$shar_count" ||
- $echo 'page04.pre:' 'original size' '448,' 'current size' "$shar_count!"
- fi
-fi
-rm -fr _sh00205
-exit 0
diff --git a/docs/tutorials/002/handler.h b/docs/tutorials/002/handler.h
deleted file mode 100644
index 9b73a1cedb4..00000000000
--- a/docs/tutorials/002/handler.h
+++ /dev/null
@@ -1,166 +0,0 @@
-
-// $Id$
-
-#ifndef LOGGING_HANDLER_H
-#define LOGGING_HANDLER_H
-
-#include "ace/INET_Addr.h"
-
-#if !defined (ACE_LACKS_PRAGMA_ONCE)
-# pragma once
-#endif /* ACE_LACKS_PRAGMA_ONCE */
-
-#include "ace/SOCK_Stream.h"
-#include "ace/Reactor.h"
-
-/*
- Since we used the template to create the acceptor, we don't know if there is a
- way to get to the reactor it uses. We'll take the easy way out and grab the
- global pointer. (There is a way to get back to the acceptor's reactor that
- we'll see later on.)
- */
-extern ACE_Reactor * g_reactor;
-
-/*
- This time we're deriving from ACE_Svc_Handler instead of ACE_Event_Handler.
- The big reason for this is because it already knows how to contain a SOCK_Stream
- and provides all of the method calls needed by the reactor. The second template
- parameter is for some advanced stuff we'll do with later servers. For now, just
- use it as is...
- */
-class Logging_Handler : public ACE_Svc_Handler < ACE_SOCK_STREAM, ACE_NULL_SYNCH >
-{
-
-public:
-
- /*
- The Acceptor<> template will open() us when there is a new client connection.
- */
- virtual int open (void *)
- {
- ACE_INET_Addr addr;
-
- /*
- Ask the peer() (held in our baseclass) to tell us the address of the cient
- which has connected. There may be valid reasons for this to fail where we
- wouldn't want to drop the connection but I can't think of one.
- */
- if (this->peer ().get_remote_addr (addr) == -1)
- return -1;
-
- /*
- The Acceptor<> won't register us with it's reactor, so we have to do so
- ourselves. This is where we have to grab that global pointer. Notice
- that we again use the READ_MASK so that handle_input() will be called
- when the client does something.
- */
- if (g_reactor->register_handler (this, ACE_Event_Handler::READ_MASK) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "(%P|%t) can't register with reactor\n"), -1);
-
- /*
- Here's another new treat. We schedule a timer event. This particular one
- will fire in two seconds and then every three seconds after that. It doesn't
- serve any useful purpose in our application other than to show you how it
- is done.
- */
- else if (g_reactor->schedule_timer (this, 0, ACE_Time_Value (2), ACE_Time_Value (3)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "can'(%P|%t) t register with reactor\n"), -1);
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) connected with %s\n", addr.get_host_name() ));
-
- return 0;
- }
-
- /*
- This is a matter of style & maybe taste. Instead of putting all of this stuff
- into a destructor, we put it here and request that everyone call destroy()
- instead of 'delete'.
- */
- virtual void destroy (void)
- {
- /*
- Remove ourselves from the reactor
- */
- g_reactor->remove_handler(this,ACE_Event_Handler::READ_MASK|ACE_Event_Handler::DONT_CALL);
-
- /*
- Cancel that timer we scheduled in open()
- */
- g_reactor->cancel_timer (this);
-
- /*
- Shut down the connection to the client.
- */
- this->peer ().close ();
-
- /*
- Free our memory.
- */
- delete this;
- }
-
- /*
- If somebody doesn't like us, they will close() us. Actually, if our open() method
- returns -1, the Acceptor<> will invoke close() on us for cleanup.
- */
- virtual int close (u_long _flags = 0)
- {
- /*
- The ACE_Svc_Handler baseclass requires the _flags parameter. We don't
- use it here though, so we mark it as UNUSED. You can accomplish the
- same thing with a signature like handle_input's below.
- */
- ACE_UNUSED_ARG(_flags);
-
- /*
- Clean up and go away.
- */
- this->destroy ();
- return 0;
- }
-
-protected:
-
- /*
- Respond to input just like Tutorial 1.
- */
- virtual int handle_input (ACE_HANDLE)
- {
- char buf[128];
- memset (buf, 0, sizeof (buf));
-
- 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:
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) from client: %s", buf));
- }
-
- return 0;
- }
-
- /*
- When the timer expires, handle_timeout() will be called. The 'arg' is the value passed
- after 'this' in the schedule_timer() call. You can pass in anything there that you can
- cast to a void*.
- */
- virtual int handle_timeout (const ACE_Time_Value & tv, const void *arg)
- {
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) handling timeout from this = %u\n", this));
- return 0;
- }
-
- /*
- Clean ourselves up when handle_input() (or handle_timer()) returns -1
- */
- virtual int handle_close(ACE_HANDLE, ACE_Reactor_Mask _mask)
- {
- this->destroy();
- return 0;
- }
-};
-
-#endif // LOGGING_HANDLER_H
diff --git a/docs/tutorials/002/page01.html b/docs/tutorials/002/page01.html
deleted file mode 100644
index 280bb0de807..00000000000
--- a/docs/tutorials/002/page01.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<HTML>
-<HEAD>
- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
- <META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (X11; I; Linux 2.0.32 i486) [Netscape]">
- <META NAME="Author" CONTENT="James CE Johnson">
- <META NAME="Description" CONTENT="A first step towards using ACE productively">
- <TITLE>ACE Tutorial 002</TITLE>
-</HEAD>
-<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F">
-
-<CENTER><B><FONT SIZE=+2>ACE Tutorial 002</FONT></B></CENTER>
-
-<CENTER><B><FONT SIZE=+2>Creating a Better Server</FONT></B></CENTER>
-
-
-<P>
-<HR WIDTH="100%">
-
-<P>In this tutorial, we will build a little on what we learned in the first
-tutorial and add a few extras. In the end, we will have a better server
-object that is actually simpler and more maintainable than the one we created
-before.</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. At the end of it all, we realized that our only
-application-specific coding was confined to the <I>handler</I> portion
-of the program. We hinted that there may be a way to eliminate hand-coding
-an <I>acceptor</I> each time we want to create a server. Here, we will
-explore that approach.</P>
-
-<P><HR WIDTH="100%">
-<CENTER>[<A HREF="../online-tutorials.html">Tutorial Index</A>] [<A HREF="page02.html">Continue This Tutorial</A>]</CENTER>
diff --git a/docs/tutorials/002/page02.html b/docs/tutorials/002/page02.html
deleted file mode 100644
index eb1ab5893e2..00000000000
--- a/docs/tutorials/002/page02.html
+++ /dev/null
@@ -1,156 +0,0 @@
-<HTML>
-<HEAD>
- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
- <META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (X11; I; Linux 2.0.32 i486) [Netscape]">
- <META NAME="Author" CONTENT="James CE Johnson">
- <META NAME="Description" CONTENT="A first step towards using ACE productively">
- <TITLE>ACE Tutorial 002</TITLE>
-</HEAD>
-<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F">
-
-<CENTER><B><FONT SIZE=+2>ACE Tutorial 002</FONT></B></CENTER>
-
-<CENTER><B><FONT SIZE=+2>Creating a Better Server</FONT></B></CENTER>
-
-
-<P>
-<HR WIDTH="100%">
-
-<P>Like Tutorial 1, this is also a rather small program.&nbsp; I'm going
-to add a couple of new ideas along the way but to make up for it I'm also
-going to simplify the acceptor a great deal.
-
-<P>
-Kirthika's Abstract:
-<UL>
-This is a server example made simpler due to the use of off-the-shelf
-components and classes from ACE.
-<P>
-Here, the Logging_Acceptor is an ACE_Acceptor class which is associated
-with the Logging_Handler and the ACE_SOCK_ACCEPTOR. This will now
-accept connection requests from the clients on being opened with the
-reactor instance passed to it.
-<P>
-We also implement a signal to capture CTRL-C [ which generates SIGINT ] using ACE_SigAction and
-ACE_SignalHandler. This signal can now be used to stop the reactor
-from handling events.
-<P>
-Then, the reactor is allowed to loop infintely until it is shut down
-using a ^C, after which both the reactor as well as the acceptor are
-destroyed.
-<P>
-The Logging_Handler derives from the ACE_Svc_Handler instead of the
-Event_Handler since the Svc_Handler has inbuilt SOCK_Stream and
-provides all the calls needed by the reactor. The Svc_Handler has the
-ability to react to events and communicate to remote tasks using the
-underlying data stream passed to it.
-<P>
-A timer is scheduled in the reactor which does nothing but simply
-display how it could be used to provide periodic processing when
-needed. The ACE_TimeValue is used to set the time period.
-<P>
-Also, optimisations have been made in the form of a separate function
-for
-destroying the objects used.
-<P>
-Thus a simpler server has now been built which successfully
-demonstrates how simple a task, writing a server can become on using
-the various ACE components judiciously.
-</UL>
-<P>We begin by looking at the <A HREF="server.cpp">main (server.cpp)</A> portion program:
-
-<P>
-<HR WIDTH="100%">
-<PRE>
-
-<font color=red>// $Id$</font>
-
-
-<font color=red>/*
- As before, we need a few ACE objects as well as our Logging_Handler declaration.
- */</font>
-<font color=blue>#include</font> "<font color=green>ace/Acceptor.h</font>"
-<font color=blue>#include</font> "<font color=green>ace/SOCK_Acceptor.h</font>"
-<font color=blue>#include</font> "<font color=green>ace/Reactor.h</font>"
-<font color=blue>#include</font> "<font color=green>handler.h</font>"
-
-<font color=red>/*
- We'll still use the global reactor pointer. There's a snappy way around this
- that shows up in later server tutorials.
- */</font>
-ACE_Reactor * g_reactor;
-
-<font color=red>/*
- This was hinted at in Tutorial 1. Remember the hand-coded acceptor that we
- created there? This template does all of that and more and better. If you
- find yourself creating code that doesn't feel like a part of your application,
- there's a good chance that ACE has a template or framework component to do
- it for you.
- */</font>
-typedef ACE_Acceptor &lt; Logging_Handler, ACE_SOCK_ACCEPTOR > Logging_Acceptor;
-
-<font color=red>/*
- One of the new things will be a signal handler so that we can exit the application
- somewhat cleanly. The 'finished' flag is used instead of the previous infninite
- loop and the 'handler' will set that flag in respose to SIGINT (CTRL-C).
- */</font>
-static sig_atomic_t finished = 0;
-extern "<font color=green>C</font>" void handler (int)
-{
- finished = 1;
-}
-
-static const u_short PORT = ACE_DEFAULT_SERVER_PORT;
-
-int main (int, char **)
-{
- <font color=red>// Create the reactor we'll register our event handler derivatives with.</font>
- g_reactor = new ACE_Reactor;
-
- <font color=red>// Create the acceptor that will listen for client connetions</font>
- Logging_Acceptor peer_acceptor;
-
- <font color=red>/*
- Notice how similar this is to the open() call in Tutorial 1. I read
- ahead when I created that one so that it would come out this way...
- */</font>
- if (peer_acceptor.open (ACE_INET_Addr (PORT), g_reactor) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "<font color=green>%p\n</font>", "<font color=green>open</font>"), -1);
-
- <font color=red>/*
- Here's the easiest way to respond to signals in your application. Simply
- construct an ACE_Sig_Action object with a "<font color=green>C</font>" function and the signal you
- want to capture. As you might expect, there is also a way to register
- signal handlers with a reactor but we take the easy-out here.
- */</font>
- ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
-
- ACE_DEBUG ((LM_DEBUG, "<font color=green>(%P|%t) starting up server logging daemon\n</font>"));
-
- <font color=red>// Perform logging service until the signal handler receives SIGINT.</font>
- while (!finished)
- g_reactor->handle_events ();
-
- <font color=red>// Close the acceptor so that no more clients will be taken in.</font>
- peer_acceptor.close();
-
- <font color=red>// Free up the memory allocated for the reactor.</font>
- delete g_reactor;
-
- ACE_DEBUG ((LM_DEBUG, "<font color=green>(%P|%t) shutting down server logging daemon\n</font>"));
-
- return 0;
-}
-
-
-<font color=blue>#if defined</font> (<font color=purple>ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION</font>)
-template class ACE_Acceptor &lt;Logging_Handler, ACE_SOCK_ACCEPTOR>;
-template class ACE_Svc_Handler&lt;ACE_SOCK_STREAM, ACE_NULL_SYNCH>;
-<font color=blue>#elif defined</font> (<font color=purple>ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA</font>)
-<font color=blue>#pragma</font> <font color=purple>instantiate</font> ACE_Acceptor &lt;Logging_Handler, ACE_SOCK_ACCEPTOR>
-<font color=blue>#pragma</font> <font color=purple>instantiate</font> ACE_Svc_Handler&lt;ACE_SOCK_STREAM, ACE_NULL_SYNCH>
-<font color=blue>#endif</font> <font color=red>/* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */</font>
-
-</PRE>
-<P><HR WIDTH="100%">
-<CENTER>[<A HREF="../online-tutorials.html">Tutorial Index</A>] [<A HREF="page03.html">Continue This Tutorial</A>]</CENTER>
diff --git a/docs/tutorials/002/page03.html b/docs/tutorials/002/page03.html
deleted file mode 100644
index f5af30830d0..00000000000
--- a/docs/tutorials/002/page03.html
+++ /dev/null
@@ -1,192 +0,0 @@
-<HTML>
-<HEAD>
- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
- <META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (X11; I; Linux 2.0.32 i486) [Netscape]">
- <META NAME="Author" CONTENT="James CE Johnson">
- <META NAME="Description" CONTENT="A first step towards using ACE productively">
- <TITLE>ACE Tutorial 002</TITLE>
-</HEAD>
-<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F">
-
-<CENTER><B><FONT SIZE=+2>ACE Tutorial 002</FONT></B></CENTER>
-
-<CENTER><B><FONT SIZE=+2>Creating a Better Server</FONT></B></CENTER>
-
-
-<P>
-<HR WIDTH="100%">
-
-<P>Now lets take a look at the new <A HREF="handler.h">Logging_Handler</A>:
-
-<P>
-<HR WIDTH="100%">
-<PRE>
-
-<font color=red>// $Id$</font>
-
-<font color=blue>#ifndef</font> <font color=purple>LOGGING_HANDLER_H</font>
-<font color=blue>#define</font> <font color=purple>LOGGING_HANDLER_H</font>
-
-<font color=blue>#include</font> "<font color=green>ace/INET_Addr.h</font>"
-
-<font color=blue>#if !defined</font> (<font color=purple>ACE_LACKS_PRAGMA_ONCE</font>)
-# pragma once
-<font color=blue>#endif</font> <font color=red>/* ACE_LACKS_PRAGMA_ONCE */</font>
-
-<font color=blue>#include</font> "<font color=green>ace/SOCK_Stream.h</font>"
-<font color=blue>#include</font> "<font color=green>ace/Reactor.h</font>"
-
-<font color=red>/*
- Since we used the template to create the acceptor, we don't know if there is a
- way to get to the reactor it uses. We'll take the easy way out and grab the
- global pointer. (There is a way to get back to the acceptor's reactor that
- we'll see later on.)
- */</font>
-extern ACE_Reactor * g_reactor;
-
-<font color=red>/*
- This time we're deriving from ACE_Svc_Handler instead of ACE_Event_Handler.
- The big reason for this is because it already knows how to contain a SOCK_Stream
- and provides all of the method calls needed by the reactor. The second template
- parameter is for some advanced stuff we'll do with later servers. For now, just
- use it as is...
- */</font>
-class Logging_Handler : public ACE_Svc_Handler &lt; ACE_SOCK_STREAM, ACE_NULL_SYNCH >
-{
-
-public:
-
- <font color=red>/*
- The Acceptor&lt;> template will open() us when there is a new client connection.
- */</font>
- virtual int open (void *)
- {
- ACE_INET_Addr addr;
-
- <font color=red>/*
- Ask the peer() (held in our baseclass) to tell us the address of the cient
- which has connected. There may be valid reasons for this to fail where we
- wouldn't want to drop the connection but I can't think of one.
- */</font>
- if (this->peer ().get_remote_addr (addr) == -1)
- return -1;
-
- <font color=red>/*
- The Acceptor&lt;> won't register us with it's reactor, so we have to do so
- ourselves. This is where we have to grab that global pointer. Notice
- that we again use the READ_MASK so that handle_input() will be called
- when the client does something.
- */</font>
- if (g_reactor->register_handler (this, <font color=#008888>ACE_Event_Handler::READ_MASK</font>) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "<font color=green>(%P|%t) can't register with reactor\n</font>"), -1);
-
- <font color=red>/*
- Here's another new treat. We schedule a timer event. This particular one
- will fire in two seconds and then every three seconds after that. It doesn't
- serve any useful purpose in our application other than to show you how it
- is done.
- */</font>
- else if (g_reactor->schedule_timer (this, 0, ACE_Time_Value (2), ACE_Time_Value (3)) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "<font color=green>can'(%P|%t) t register with reactor\n</font>"), -1);
-
- ACE_DEBUG ((LM_DEBUG, "<font color=green>(%P|%t) connected with %s\n</font>", addr.get_host_name() ));
-
- return 0;
- }
-
- <font color=red>/*
- This is a matter of style & maybe taste. Instead of putting all of this stuff
- into a destructor, we put it here and request that everyone call destroy()
- instead of 'delete'.
- */</font>
- virtual void destroy (void)
- {
- <font color=red>/*
- Remove ourselves from the reactor
- */</font>
- g_reactor->remove_handler(this,<font color=#008888>ACE_Event_Handler::READ_MASK</font>|ACE_Event_Handler::DONT_CALL);
-
- <font color=red>/*
- Cancel that timer we scheduled in open()
- */</font>
- g_reactor->cancel_timer (this);
-
- <font color=red>/*
- Shut down the connection to the client.
- */</font>
- this->peer ().close ();
-
- <font color=red>/*
- Free our memory.
- */</font>
- delete this;
- }
-
- <font color=red>/*
- If somebody doesn't like us, they will close() us. Actually, if our open() method
- returns -1, the Acceptor&lt;> will invoke close() on us for cleanup.
- */</font>
- virtual int close (u_long _flags = 0)
- {
- <font color=red>/*
- The ACE_Svc_Handler baseclass requires the _flags parameter. We don't
- use it here though, so we mark it as UNUSED. You can accomplish the
- same thing with a signature like handle_input's below.
- */</font>
- ACE_UNUSED_ARG(_flags);
-
- <font color=red>/*
- Clean up and go away.
- */</font>
- this->destroy ();
- return 0;
- }
-
-protected:
-
- <font color=red>/*
- Respond to input just like Tutorial 1.
- */</font>
- virtual int handle_input (ACE_HANDLE)
- {
- char buf[128];
- memset (buf, 0, sizeof (buf));
-
- switch (this->peer ().recv (buf, sizeof buf))
- {
- case -1:
- ACE_ERROR_RETURN ((LM_ERROR, "<font color=green>(%P|%t) %p bad read\n</font>", "<font color=green>client logger</font>"), -1);
- case 0:
- ACE_ERROR_RETURN ((LM_ERROR, "<font color=green>(%P|%t) closing log daemon (fd = %d)\n</font>", this->get_handle ()), -1);
- default:
- ACE_DEBUG ((LM_DEBUG, "<font color=green>(%P|%t) from client: %s</font>", buf));
- }
-
- return 0;
- }
-
- <font color=red>/*
- When the timer expires, handle_timeout() will be called. The 'arg' is the value passed
- after 'this' in the schedule_timer() call. You can pass in anything there that you can
- cast to a void*.
- */</font>
- virtual int handle_timeout (const ACE_Time_Value & tv, const void *arg)
- {
- ACE_DEBUG ((LM_DEBUG, "<font color=green>(%P|%t) handling timeout from this = %u\n</font>", this));
- return 0;
- }
-
- <font color=red>/*
- Clean ourselves up when handle_input() (or handle_timer()) returns -1
- */</font>
- virtual int handle_close(ACE_HANDLE, ACE_Reactor_Mask _mask)
- {
- this->destroy();
- return 0;
- }
-};
-
-<font color=blue>#endif</font> <font color=red>// LOGGING_HANDLER_H</font>
-</PRE>
-<P><HR WIDTH="100%">
-<CENTER>[<A HREF="../online-tutorials.html">Tutorial Index</A>] [<A HREF="page04.html">Continue This Tutorial</A>]</CENTER>
diff --git a/docs/tutorials/002/page04.html b/docs/tutorials/002/page04.html
deleted file mode 100644
index 15a58015b48..00000000000
--- a/docs/tutorials/002/page04.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<HTML>
-<HEAD>
- <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
- <META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en] (X11; I; Linux 2.0.32 i486) [Netscape]">
- <META NAME="Author" CONTENT="James CE Johnson">
- <META NAME="Description" CONTENT="A first step towards using ACE productively">
- <TITLE>ACE Tutorial 002</TITLE>
-</HEAD>
-<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F">
-
-<CENTER><B><FONT SIZE=+2>ACE Tutorial 002</FONT></B></CENTER>
-
-<CENTER><B><FONT SIZE=+2>Creating a Better Server</FONT></B></CENTER>
-
-
-<P>
-<HR WIDTH="100%">
-
-<P>Well, that's it for the second tutorial. We've found a much easier way
-to create a server, especially the acceptor part. At the same time, we
-introduced more functionality and robustness. Not bad for a day's work.
-<BR>&nbsp;
-<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>
-<LI>
-<A HREF="handler.h">handler.h</A></LI>
-</UL>
-
-<P><HR WIDTH="100%">
-<CENTER>[<A HREF="../online-tutorials.html">Tutorial Index</A>] </CENTER>
diff --git a/docs/tutorials/002/server.cpp b/docs/tutorials/002/server.cpp
deleted file mode 100644
index bca90aa01bc..00000000000
--- a/docs/tutorials/002/server.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-
-// $Id$
-
-
-/*
- As before, we need a few ACE objects as well as our Logging_Handler declaration.
- */
-#include "ace/Acceptor.h"
-#include "ace/SOCK_Acceptor.h"
-#include "ace/Reactor.h"
-#include "handler.h"
-
-/*
- We'll still use the global reactor pointer. There's a snappy way around this
- that shows up in later server tutorials.
- */
-ACE_Reactor * g_reactor;
-
-/*
- This was hinted at in Tutorial 1. Remember the hand-coded acceptor that we
- created there? This template does all of that and more and better. If you
- find yourself creating code that doesn't feel like a part of your application,
- there's a good chance that ACE has a template or framework component to do
- it for you.
- */
-typedef ACE_Acceptor < Logging_Handler, ACE_SOCK_ACCEPTOR > Logging_Acceptor;
-
-/*
- One of the new things will be a signal handler so that we can exit the application
- somewhat cleanly. The 'finished' flag is used instead of the previous infninite
- loop and the 'handler' will set that flag in respose to SIGINT (CTRL-C).
- */
-static sig_atomic_t finished = 0;
-extern "C" void handler (int)
-{
- finished = 1;
-}
-
-static const u_short PORT = ACE_DEFAULT_SERVER_PORT;
-
-int main (int, char **)
-{
- // Create the reactor we'll register our event handler derivatives with.
- g_reactor = new ACE_Reactor;
-
- // Create the acceptor that will listen for client connetions
- Logging_Acceptor peer_acceptor;
-
- /*
- Notice how similar this is to the open() call in Tutorial 1. I read
- ahead when I created that one so that it would come out this way...
- */
- if (peer_acceptor.open (ACE_INET_Addr (PORT), g_reactor) == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"), -1);
-
- /*
- Here's the easiest way to respond to signals in your application. Simply
- construct an ACE_Sig_Action object with a "C" function and the signal you
- want to capture. As you might expect, there is also a way to register
- signal handlers with a reactor but we take the easy-out here.
- */
- ACE_Sig_Action sa ((ACE_SignalHandler) handler, SIGINT);
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) starting up server logging daemon\n"));
-
- // Perform logging service until the signal handler receives SIGINT.
- while (!finished)
- g_reactor->handle_events ();
-
- // Close the acceptor so that no more clients will be taken in.
- peer_acceptor.close();
-
- // Free up the memory allocated for the reactor.
- delete g_reactor;
-
- ACE_DEBUG ((LM_DEBUG, "(%P|%t) shutting down server logging daemon\n"));
-
- return 0;
-}
-
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Acceptor <Logging_Handler, ACE_SOCK_ACCEPTOR>;
-template class ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Acceptor <Logging_Handler, ACE_SOCK_ACCEPTOR>
-#pragma instantiate ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
-