General Notes:

This demo is provided as both interpreted and compiled 4D structures. 
This demo will be somewhat slow if run in interpreted mode.  Compiled,
however, it will be very fast.  This is because of the text parsing
and BLOB manipulation being done in the components.  Usually, you will
only want to use the interpreted version of the demo to see the code. 
To run the demo, though, it is probably best to run compiled for the
dramatic speed increase this will afford.

When starting the interpreted version of the demo, you will encounter
a Debug window.  The TRACE command is placed before any code is run to
allow you to quickly enter the database without having to wait for all
of the startup code to run.  You will also encounter the TRACE command
when quitting the database.  If you aborted the INIT_APPL method when
launching, the components will not be initialized, so you will want to
abort the QUIT_APPL method to avoid calling other component methods
(this can cause errors, obviously).



To use the TCPsd_Demo:

Just open the database structure ("TCPsd_demo" for interpreted or
"TCPsd_demo.comp" for compiled) with 4D 6.7.x.  The INIT_APPL method
contains everything necessary to start a very based HTTP server using
TCP Server Deux.  A standard response will be given for any request to
any IP address or domain on that computer.

To test the TCPsd_Demo, open a web browser and access the IP address
or DNS name of the computer running the TCPsd_Demo.  For example, if
the IP address of the computer running TCPsd_Demo is 192.10.23.1, then
enter "http://192.10.23.1/" in your web browser to access the
TCPsd_Demo.  If the machine has a domain of www.mydevmachine.com
assigned to it, then enter "http://dev.mydomain.com/" in your web
browser to access the TCPsd_Demo.

You should see the web page built by the demo displayed in your web
browser.  If you are running the TCPsd_Demo database in interpreted
mode, this will take a few seconds.

You can also access the IP address 127.0.0.1 (e.g. "http://127.0.01/")
if the demo is running on the same computer as the web browser.  That
IP address always goes to the local computer, so you can access this
address even if you are not connected to a network.  



Tour of the TCPsd_Demo code:

The INIT_APPL method calls the methods necessary to start a very basic
HTTP server using TCP Server Deux.  This consists of initialization
methods, setting the preferences, creating a service, and starting the
server.  The line setting the server preferences is actually
unnecessary, since the preferences have default values which can be
used.

The method HTTP_Test_Server is the handler method for the HTTP service
which was created in the On Startup method.  This method will be run
inside of a handler process, so it may be run concurrently in
different processes.  It first obtains the stream reference for the
connection it is handling, and then uses TCP Deux methods to send and
receive data or get connection information.

The QUIT_APPL method contains code for stopping the TCP Server.  This
code could be used to stop the server at any point, so provisions
could be made to start the server and stop it "on the fly".  In any
case, the server should be stopped before the database quits.

The TCP Server Deux Time Log feature is turned on in this demo.
Basically, this is a diagnostic tool built into TCP Server Deux for
determining response times of different sections of TCP Server Deux
code and your handler methods. A sample of the Time Log data is
available in the text document entitled "TCPsd_TimeLog.txt" included
with the demo archive. As you run the demo, more entries will be made
in this document.



Troubleshooting:

"I haveve started TCPsd_Demo, but the demo page doesn't display in my
web browser."

Make sure the web browser is accessing the correct IP address or DNS
name.  Also, if you are using Internet Explorer on the same computer
as the demo, switch to the demo.  Internet Explorer uses all
processing time while it is waiting for a page to load, so the demo
will not be able to run very well on the same machine if you are using
IE (see below).

"The demo web page takes a long time to display in my web browser."

Run the compiled demo!  The interpreted demo will run pretty slow. 
Also, if you are using Internet Explorer on the same computer as the
TCPsd_Demo, bring the demo to the front.  Internet Explorer uses all
processing time while it is waiting for a page to load, so the demo
will no be able to run.

"There are errors related to the plugin commands."

4th Dimension installs 4D Pack (formerly ACI Pack) and Internet
Commands into the system Mac4DX/Win4DX folder so that they can be
available to all 4D databases.  The demo includes all necessary
plugins in its own 4DX folder; this includes 4D Pack and a stub for
Internet Commands.  Sometimes, the plugins in the system 4DX folder
may cause resource conflicts with the plugins in the demo's 4DX
folder.  You can temporarily remove the conflicting plugins from the
system 4DX folder to see if this is causing the problem.
