Background: Web-Servers
and CGI
Before building a web site, it is important to understand
the architecture of the Internet. The World Wide Web (WWW)
is composed of three principle components: A wide-area network
running TCP/IP; web-servers; and web-browsers. TCP/IP is a
platform independent (Windows, Mac, OS2, UNIX, etc.,) network
protocol used by the Internet (and Intranets). It defines
a standard for sending and routing packets of data between
servers and clients. In this case, web-servers and web-browsers.
A web-server is a simple application that waits for requests
from a web-browser and returns files (HTML, images, etc.).
A web-browser is also a simple application that displays information
(decodes the HTML and inserts/formats the appropriate images)
in a window.

Figure 1: World Wide Web
HTML files are simple ASCII files which are used to hold
information that will appear within browsers. These text files
contain embedded codes for font attributes, locations of images,
simple form elements (edit boxes, list-boxes, check-boxes,
buttons, and radio buttons), etc.
<HTML>
<HEAD>
<TITLE>Introduction to the Internet</TITLE>
</HEAD>
<BODY>
<P>This is a simple example of <B>HTML</B>.
</BODY>
</HTML>
Figure 2: HTML Sample
There are only a few dozen formatting elements available
for HTML 3.2, although several advanced extensions such as
frames, tables, and colors, are supported by proprietary browsers
from Microsoft and Netscape.
The architecture of this system relies on page-oriented hyper-text
links to structure and disseminate information. Graphics are
being increasingly used by web page designers to provide the
illusion of a more cohesive document structure. Although at
its roots the system is considerably less sophisticated than
most people realize. Perhaps the most important consideration
when designing web content is the static nature of the medium.
There is no way to interactively communicate with a server
to update the contents of a web page without resorting to
Java on the client/browser side.
The standard method of requesting information from a web-server
is to use a URL (Uniform Resource Locator). This is usually
the address of an HTML file on disk. i.e. "http://www.geometrix.bc.ca/geonew1.htm".
If this URL were entered in a web-browser's "Open Location"
edit box, it would cause the GeoMetrix web-server to return
the "What's New" page from the GeoMetrix web site.
For web-servers that support CGI (Common Gateway Interface),
nearly all do, you may also send a URL that contains the name
of an executable (.exe, .com, or .bat) file. The web-server
will run the application, passing in names of files containing
posted form information, and wait for it to terminate. The
application is responsible for creating an HTML file which
the server will return after the application terminates.
Executables can be as simple as a batch file. However accessing
a database is a far more complex operation. Even with C/C++,
Pascal, or Delphi, the overhead of loading a 500K+ executable
(and/or DLLs) and connecting to a database can take far too
long for the server to process each transaction. Larger database
applications, such as Superbase, FoxPro, Paradox, dBase for
Windows, Access, etc. could not be repeatedly loaded in such
a manor. Such applications normally use a small intermediate
executable (Gateway Program) which, when run, contacts a copy
of FoxPro, Paradox, etc., that is already running. This can
be accomplished through a number of methods the most common
being DDE.
For example, connecting to a copy of Superbase using a web-server
and CGI can be accomplished as described in Figure 3.

Figure 3: CGI Interface to Superbase
This configuration processes each transaction
request sequentially. Transactions are usually completed
within a fraction of a second allowing up to several hundred
to be completed each minute (on Pentium-based servers).
Our experience has shown that when using this configuration
the only bottleneck that occurs is with the web server software
trying to send back the output to slow connections (a client
browser using a 14.4 connection through a slow ISP). This
in no way limits the ability for Superbase to continue processing
transactions.
|