summaryrefslogtreecommitdiff
path: root/docs/tutorials
diff options
context:
space:
mode:
authorjcej <jcej@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-21 20:17:57 +0000
committerjcej <jcej@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-01-21 20:17:57 +0000
commit81f5958888d1e773079e63e576569e049089ef95 (patch)
tree0372d93a694cb5ab72c4cfcffb28d044f8a76a7d /docs/tutorials
parent374a8f14fecefeee2b0ccc58cf09ee9e8ffc324c (diff)
downloadATCD-81f5958888d1e773079e63e576569e049089ef95.tar.gz
*** empty log message ***
Diffstat (limited to 'docs/tutorials')
-rw-r--r--docs/tutorials/001/Makefile17
-rw-r--r--docs/tutorials/001/page01.html19
-rw-r--r--docs/tutorials/001/page02.html20
-rw-r--r--docs/tutorials/001/page03.html20
-rw-r--r--docs/tutorials/001/page04.html23
-rw-r--r--docs/tutorials/001/page05.html17
-rw-r--r--docs/tutorials/005/client_handler.cpp11
-rw-r--r--docs/tutorials/005/page05.html11
-rw-r--r--docs/tutorials/006/client_handler.cpp19
-rw-r--r--docs/tutorials/006/page01.html3
-rw-r--r--docs/tutorials/006/page05.html19
11 files changed, 133 insertions, 46 deletions
diff --git a/docs/tutorials/001/Makefile b/docs/tutorials/001/Makefile
index cf0d529e3ea..66df5f9214c 100644
--- a/docs/tutorials/001/Makefile
+++ b/docs/tutorials/001/Makefile
@@ -37,14 +37,31 @@ include $(ACE_ROOT)/include/makeinclude/rules.local.GNU
# Local targets
#----------------------------------------------------------------------------
+# In order to make the generation of HTML pages from sourcecode
+# easier, I've started putting the comments into *.pre and *.pst files.
+# Those are then combined (via the perl script "combine") with the
+# source code to create the HTMLs. In an effort to declutter the
+# directory, I archive the component files in a shell-archive (eg --
+# shar) file that is commited to the repository.
+
+# Invoke the combine script to pull together the pre-code comments,
+# code and post-code comments that makeup a tutorial page. 'combine'
+# keys itself off of the *.pre files to know what it should build. An
+# accessory file "bodies" specifies which source files comprise the
+# body of each tutorial page.
HTML : #
[ -f hdr ] || $(MAKE) UNSHAR
perl ../combine *.pre ; chmod +r *.html
+# The SHAR target simply invokes "shar" to create the shell archive.
+# It is important to include all "component" files in the shar command
+# line so that they will be included in the archive. It is not
+# necessary to include the source code files since they're commited as-is.
SHAR : #
[ ! -f combine.shar ] || exit 1
shar -T hdr bodies *.pre *.pst > combine.shar && rm -f hdr bodies *.pre *.pst
+# For orthogonality, we have an UNSHAR to match SHAR.
UNSHAR : #
sh combine.shar
diff --git a/docs/tutorials/001/page01.html b/docs/tutorials/001/page01.html
index 3155a0b9c18..e3e0a6dc714 100644
--- a/docs/tutorials/001/page01.html
+++ b/docs/tutorials/001/page01.html
@@ -1,18 +1,22 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
- <TITLE>ACE Tutorial 001</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (Win95; I) [Netscape]">
+ <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 001</TITLE>
</HEAD>
-<BODY text = "#000000" link="#000fff" vlink="#ff0f0f" bgcolor="#ffffff">
+<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F">
+<CENTER><B><FONT SIZE=+2>ACE Tutorial 001</FONT></B></CENTER>
+
+<CENTER><B><FONT SIZE=+2>A Beginners Guide to Using the ACE Toolkit</FONT></B></CENTER>
+
+
+<P>
+<HR WIDTH="100%">
-<CENTER><P><B><FONT SIZE=+2>ACE&nbsp;Tutorial 001<BR>
-A Beginners Guide to Using the ACE&nbsp;Toolkit</FONT></B></P></CENTER>
-<hr>
<P>The purpose of this tutorial is to show you how to create a very simple
server capable of handling multiple client connections. Unlike a &quot;traditional&quot;
server application, this one handles all requests in one process. Issues
@@ -97,6 +101,5 @@ If all of this is gibberish and makes you think that ACE is way to hard to
learn, don't worry. We'll go into all the details and explain as we go.
I only went into all of this so that it can kick around in the back of your
mind until you need it later.
-<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/001/page02.html b/docs/tutorials/001/page02.html
index dff82baa375..e7b8dde396c 100644
--- a/docs/tutorials/001/page02.html
+++ b/docs/tutorials/001/page02.html
@@ -1,18 +1,21 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
- <TITLE>ACE Tutorial 001</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (Win95; I) [Netscape]">
+ <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 001</TITLE>
</HEAD>
-<BODY text = "#000000" link="#000fff" vlink="#ff0f0f" bgcolor="#ffffff">
+<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F">
+
+<CENTER><B><FONT SIZE=+2>ACE Tutorial 001</FONT></B></CENTER>
+
+<CENTER><B><FONT SIZE=+2>A Beginners Guide to Using the ACE Toolkit</FONT></B></CENTER>
-<CENTER><P><B><FONT SIZE=+2>ACE&nbsp;Tutorial 001<BR>
-A Beginners Guide to Using the ACE&nbsp;Toolkit</FONT></B></P></CENTER>
+<P>
+<HR WIDTH="100%">
-<hr>
<P>From here, we to move on to the main program loop. In a way, we're
starting at the final product when we do this, but it is a very simple
piece of code and a good place to start.
@@ -66,7 +69,7 @@ The READ_MASK is also defined in the ACE_Event_Handler class. It's
used to inform the Reactor that you want to register an event handler
to "read" data from an established connection.
</UL>
-<hr>
+<HR WIDTH="100%">
<PRE>
<font color=red>// $Id$</font>
@@ -173,6 +176,5 @@ Enter an infinite loop to let the reactor handle the events</LI>
On the next page, we will take a look at the acceptor and how it responds
to new connection requests.
-<P>
<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/001/page03.html b/docs/tutorials/001/page03.html
index 5f45ca0826f..280b2aaec4c 100644
--- a/docs/tutorials/001/page03.html
+++ b/docs/tutorials/001/page03.html
@@ -1,18 +1,21 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
- <TITLE>ACE Tutorial 001</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (Win95; I) [Netscape]">
+ <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 001</TITLE>
</HEAD>
-<BODY text = "#000000" link="#000fff" vlink="#ff0f0f" bgcolor="#ffffff">
+<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F">
+<CENTER><B><FONT SIZE=+2>ACE Tutorial 001</FONT></B></CENTER>
-<CENTER><P><B><FONT SIZE=+2>ACE&nbsp;Tutorial 001<BR>
-A Beginners Guide to Using the ACE&nbsp;Toolkit</FONT></B></P></CENTER>
+<CENTER><B><FONT SIZE=+2>A Beginners Guide to Using the ACE Toolkit</FONT></B></CENTER>
+
+
+<P>
+<HR WIDTH="100%">
-<hr>
<P>Now we begin to look at the <A HREF="acceptor.h">acceptor</A> object.
<P>
@@ -186,7 +189,8 @@ protected:
<font color=blue>#endif</font> <font color=red>/* _CLIENT_ACCEPTOR_H */</font>
</PRE>
-<HR WIDTH="100%"></PRE>
+<HR>
+
It is important to notice here that we have done very little application-specifc
code in developing this object. In fact, if we take out the progress information,
the only app-specific code is when we create the new <I>Logging_Handler</I>
diff --git a/docs/tutorials/001/page04.html b/docs/tutorials/001/page04.html
index 079947a3b3a..1ed51dbac02 100644
--- a/docs/tutorials/001/page04.html
+++ b/docs/tutorials/001/page04.html
@@ -1,23 +1,26 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
- <TITLE>ACE Tutorial 001</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (Win95; I) [Netscape]">
+ <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 001</TITLE>
</HEAD>
-<BODY text = "#000000" link="#000fff" vlink="#ff0f0f" bgcolor="#ffffff">
+<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F">
+
+<CENTER><B><FONT SIZE=+2>ACE Tutorial 001</FONT></B></CENTER>
+<CENTER><B><FONT SIZE=+2>A Beginners Guide to Using the ACE Toolkit</FONT></B></CENTER>
-<CENTER><P><B><FONT SIZE=+2>ACE&nbsp;Tutorial 001<BR>
-A Beginners Guide to Using the ACE&nbsp;Toolkit</FONT></B></P></CENTER>
-<hr>
+<P>
+<HR WIDTH="100%">
+
<P>Now we begin to look at the <A HREF="logger.h">logger</A>
object.
<P>
-<HR>
+<HR WIDTH="100%">
<PRE>
<font color=red>// $Id$</font>
@@ -197,9 +200,7 @@ protected:
<font color=blue>#endif</font> <font color=red>/* _CLIENT_HANDLER_H */</font>
</PRE>
-<HR WIDTH="100%">
-
-<P>
+<HR>
The comments really should tell the story. The really
interesting stuff is in <i>handle_input()</i>. Everything
else is just housekeeping.
diff --git a/docs/tutorials/001/page05.html b/docs/tutorials/001/page05.html
index 8725e1f410f..53bb40efb18 100644
--- a/docs/tutorials/001/page05.html
+++ b/docs/tutorials/001/page05.html
@@ -1,18 +1,21 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
- <TITLE>ACE Tutorial 001</TITLE>
- <META NAME="GENERATOR" CONTENT="Mozilla/3.01Gold (Win95; I) [Netscape]">
+ <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 001</TITLE>
</HEAD>
-<BODY text = "#000000" link="#000fff" vlink="#ff0f0f" bgcolor="#ffffff">
+<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F">
+
+<CENTER><B><FONT SIZE=+2>ACE Tutorial 001</FONT></B></CENTER>
+<CENTER><B><FONT SIZE=+2>A Beginners Guide to Using the ACE Toolkit</FONT></B></CENTER>
-<CENTER><P><B><FONT SIZE=+2>ACE&nbsp;Tutorial 001<BR>
-A Beginners Guide to Using the ACE&nbsp;Toolkit</FONT></B></P></CENTER>
-<hr>
+<P>
+<HR WIDTH="100%">
+
<P>This concludes the first tutorial on using ACE. We've learned how to
create a simple server without knowing very much about network programming.
diff --git a/docs/tutorials/005/client_handler.cpp b/docs/tutorials/005/client_handler.cpp
index 84f2d98d6bb..ca9d395c44f 100644
--- a/docs/tutorials/005/client_handler.cpp
+++ b/docs/tutorials/005/client_handler.cpp
@@ -227,5 +227,16 @@ int Client_Handler::process (char *_rdbuf, int _rdbuf_len)
ACE_DEBUG ((LM_DEBUG, "(%P|%t) from client: %s", _rdbuf));
}
+ /*
+ It's also worth mentioning that recv() has a cousin: recv_n().
+ recv_n() will receive exactly the number of bytes you provide
+ it. This is very good when you know exactly how much you expect
+ to receive. For the application here, unfortunately, we don't
+ have any idea how much the client will be sending. recv() will
+ read up-to-but-not-more-than the number of bytes we specify
+ (e.g. -- _rdbuf_len). That works well when we don't know how
+ much the client will provide.
+ */
+
return 0;
}
diff --git a/docs/tutorials/005/page05.html b/docs/tutorials/005/page05.html
index 029683a7ca1..198b2d737ce 100644
--- a/docs/tutorials/005/page05.html
+++ b/docs/tutorials/005/page05.html
@@ -252,6 +252,17 @@ int <font color=#008888>Client_Handler::process</font> (char *_rdbuf, int _rdbuf
ACE_DEBUG ((LM_DEBUG, "<font color=green>(%P|%t) from client: %s</font>", _rdbuf));
}
+ <font color=red>/*
+ It's also worth mentioning that recv() has a cousin: recv_n().
+ recv_n() will receive exactly the number of bytes you provide
+ it. This is very good when you know exactly how much you expect
+ to receive. For the application here, unfortunately, we don't
+ have any idea how much the client will be sending. recv() will
+ read up-to-but-not-more-than the number of bytes we specify
+ (e.g. -- _rdbuf_len). That works well when we don't know how
+ much the client will provide.
+ */</font>
+
return 0;
}
</PRE>
diff --git a/docs/tutorials/006/client_handler.cpp b/docs/tutorials/006/client_handler.cpp
index a4292fec2bd..6e88897ee22 100644
--- a/docs/tutorials/006/client_handler.cpp
+++ b/docs/tutorials/006/client_handler.cpp
@@ -112,12 +112,23 @@ int Client_Handler::open (void *_acceptor)
If we are told to use the single-threaded strategy, there is no difference
between this and the Tutorial 5 implementation.
+
+ Note that if we're in thread-per-connection mode, open() is
+ exited at this point. Furthermore, thread-per-connection mode
+ does not use the reactor which means that handle_input() and it's
+ fellows are not invoked.
*/
if( acceptor->thread_per_connection() )
{
return this->activate();
}
+ // ************************************************************************
+ // From here on, we're doing the traditional reactor thing. If
+ // you're operating in thread-per-connection mode, this code does
+ // not apply.
+ // ************************************************************************
+
/*
Our reactor reference will be set when we register ourselves but I decided
to go ahead and set it here. No good reason really...
@@ -186,7 +197,9 @@ int Client_Handler::close(u_long flags)
it will invoke this handle_input() method on us. As I mentioned, the _handle
parameter isn't useful to us but it narrows the list of methods the reactor
has to worry about and the list of possible virtual functions we would have
- to override.
+ to override.
+
+ Again, this is not used if we're in thread-per-connection mode.
*/
int Client_Handler::handle_input (ACE_HANDLE _handle)
{
@@ -234,6 +247,10 @@ int Client_Handler::handle_close (ACE_HANDLE _handle, ACE_Reactor_Mask _mask)
create a multi-threaded application, these are your tools! Simply override
the svc() method in your derivative and arrange for your activate() method
to be called. The svc() method then executes in the new thread.
+
+ Of course, this is only valid if we're in thread-per-connection
+ mode. If we're using the reactor model, then svc() never comes
+ into play.
*/
int Client_Handler::svc(void)
{
diff --git a/docs/tutorials/006/page01.html b/docs/tutorials/006/page01.html
index 28a3d392d33..31380d02b6d 100644
--- a/docs/tutorials/006/page01.html
+++ b/docs/tutorials/006/page01.html
@@ -56,5 +56,6 @@ reactor and handles future events.
Thus a simple, thread-per-connection server has been built which doesnt
delve too deeply into mutli-threading issues.
</ul>
-<font size=-1>* Abstract by Kirthika as always</font><P><HR WIDTH="100%">
+<font size=-1>* Abstract by Kirthika as always</font>
+<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/006/page05.html b/docs/tutorials/006/page05.html
index 80b4e969b19..94cb1554897 100644
--- a/docs/tutorials/006/page05.html
+++ b/docs/tutorials/006/page05.html
@@ -136,12 +136,23 @@ int <font color=#008888>Client_Handler::open</font> (void *_acceptor)
If we are told to use the single-threaded strategy, there is no difference
between this and the Tutorial 5 implementation.
+
+ Note that if we're in thread-per-connection mode, open() is
+ exited at this point. Furthermore, thread-per-connection mode
+ does not use the reactor which means that handle_input() and it's
+ fellows are not invoked.
*/</font>
if( acceptor->thread_per_connection() )
{
return this->activate();
}
+ <font color=red>// ************************************************************************</font>
+ <font color=red>// From here on, we're doing the traditional reactor thing. If</font>
+ <font color=red>// you're operating in thread-per-connection mode, this code does</font>
+ <font color=red>// not apply.</font>
+ <font color=red>// ************************************************************************</font>
+
<font color=red>/*
Our reactor reference will be set when we register ourselves but I decided
to go ahead and set it here. No good reason really...
@@ -210,7 +221,9 @@ int <font color=#008888>Client_Handler::close</font>(u_long flags)
it will invoke this handle_input() method on us. As I mentioned, the _handle
parameter isn't useful to us but it narrows the list of methods the reactor
has to worry about and the list of possible virtual functions we would have
- to override.
+ to override.
+
+ Again, this is not used if we're in thread-per-connection mode.
*/</font>
int <font color=#008888>Client_Handler::handle_input</font> (ACE_HANDLE _handle)
{
@@ -258,6 +271,10 @@ int <font color=#008888>Client_Handler::handle_close</font> (ACE_HANDLE _handle,
create a multi-threaded application, these are your tools! Simply override
the svc() method in your derivative and arrange for your activate() method
to be called. The svc() method then executes in the new thread.
+
+ Of course, this is only valid if we're in thread-per-connection
+ mode. If we're using the reactor model, then svc() never comes
+ into play.
*/</font>
int <font color=#008888>Client_Handler::svc</font>(void)
{