summaryrefslogtreecommitdiff
path: root/docs/tutorials/009/page02.html
diff options
context:
space:
mode:
Diffstat (limited to 'docs/tutorials/009/page02.html')
-rw-r--r--docs/tutorials/009/page02.html130
1 files changed, 0 insertions, 130 deletions
diff --git a/docs/tutorials/009/page02.html b/docs/tutorials/009/page02.html
deleted file mode 100644
index e2997a16409..00000000000
--- a/docs/tutorials/009/page02.html
+++ /dev/null
@@ -1,130 +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">
- <TITLE>ACE Tutorial 009</TITLE>
-</HEAD>
-<BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#000FFF" VLINK="#FF0F0F">
-
-<CENTER><B><FONT SIZE=+2>ACE Tutorial 009</FONT></B></CENTER>
-
-<CENTER><B><FONT SIZE=+2>Sending and receiving datagrams again</FONT></B></CENTER>
-
-
-<P>
-<HR WIDTH="100%">
-
-<P>Let's take a look at our new <A HREF="server.cpp">server.cpp</A> where
-we add in just a bit of code to examine the datagram contents before responding.
-
-<P>
-<HR WIDTH="100%"><TT></TT>
-
-<P><TT>/*</TT>
-<BR><TT>&nbsp;&nbsp; The actual datagram operations here are exactly the
-same as those used in</TT>
-<BR><TT>&nbsp;&nbsp; the previous tutorial.&nbsp; What we've added is some
-logic that will prevent</TT>
-<BR><TT>&nbsp;&nbsp; this server from responding to just any old datagram.&nbsp;
-I'll limit my</TT>
-<BR><TT>&nbsp;&nbsp; comments to those pieces of code.</TT>
-<BR><TT>&nbsp;*/</TT><TT></TT>
-
-<P><TT>#include "ace/SOCK_Dgram.h"</TT>
-<BR><TT>#include "ace/INET_Addr.h"</TT><TT></TT>
-
-<P><TT>static const u_short PORT = ACE_DEFAULT_SERVER_PORT;</TT><TT></TT>
-
-<P><TT>/*</TT>
-<BR><TT>&nbsp;&nbsp; In order to be more selective, our server will be
-started with a</TT>
-<BR><TT>&nbsp;&nbsp; "signature".&nbsp; If none is given, we'll use the
-one here instead.</TT>
-<BR><TT>&nbsp;*/</TT>
-<BR><TT>static const char *default_signature = "Hello World!";</TT><TT></TT>
-
-<P><TT>int main (int argc, char *argv[])</TT>
-<BR><TT>{</TT>
-<BR><TT>&nbsp; ACE_INET_Addr local (PORT);</TT>
-<BR><TT>&nbsp; ACE_SOCK_Dgram dgram;</TT><TT></TT>
-
-<P><TT>&nbsp; if (dgram.open (local) == -1)</TT>
-<BR><TT>&nbsp; {</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp; ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "open"),
--1);</TT>
-<BR><TT>&nbsp; }</TT><TT></TT>
-
-<P><TT>&nbsp; char buf[512];</TT>
-<BR><TT>&nbsp; ACE_INET_Addr remote;</TT><TT></TT>
-
-<P><TT>&nbsp; while (dgram.recv (buf, sizeof (buf), remote) != -1)</TT>
-<BR><TT>&nbsp; {</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp; /*</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; What did the client say?</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp; */</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp; ACE_DEBUG ((LM_DEBUG, "(%P|%t) Received (%s)
-from (%s)\n", buf, remote.get_host_name ()));</TT><TT></TT>
-
-<P><TT>&nbsp;&nbsp;&nbsp; /*</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Use a simple string-op to
-decide if the client is one of our own.&nbsp; Of</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; course, you could have sent
-numeric values or even a struct of data. For</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; this simple exercise, however,
-strings are just fine.</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp; */</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp; if (ACE_OS::strcmp (buf, argc > 1 ? argv[1]
-: default_signature))</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp; {</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If the client
-didn't say something we like then log it and move on.</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_DEBUG ((LM_DEBUG,</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-"(%P|%t) Client query does not match our signature (%s).&nbsp; Response
-not sent.\n",</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-argc > 1 ? argv[1] : default_signature));</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp; }</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp; else</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp; {</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; As before, we
-respond to the client's query.</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */</TT><TT></TT>
-
-<P><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_INET_Addr local ((u_short) 0);</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_SOCK_Dgram client;</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (client.open (local) == -1)</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_ERROR_RETURN
-((LM_ERROR, "%p\n", "response open"), -1);</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</TT><TT></TT>
-
-<P><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sprintf (buf, "I am here");</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (client.send (buf, strlen (buf)
-+ 1, remote) == -1)</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ACE_ERROR_RETURN
-((LM_ERROR, "%p\n", "response send"), -1);</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</TT>
-<BR><TT>&nbsp;&nbsp;&nbsp; }</TT>
-<BR><TT>&nbsp; }</TT><TT></TT>
-
-<P><TT>&nbsp; return (0);</TT>
-<BR><TT>}</TT><TT></TT>
-
-<P>
-<HR WIDTH="100%">
-
-<P>Let's move on and see what changes the clients require...
-
-<P>
-<HR WIDTH="100%">
-<CENTER>[<A HREF="..">Tutorial Index</A>] [<A HREF="page03.html">Continue
-This Tutorial</A>]</CENTER>
-
-</BODY>
-</HTML>