Web Server Programming

Chapter 1
Introduction.

Client-server programming with TCP/IP

The classic text on how to write client-server programs using Berkeley sockets and TCP/IP was the one by Stevens ( Unix Network Programming, published by Prentice Hall in 1990 and apparently still in print). Amazon has several hundred more recent titles covering this field; including several other titles by W.R. Stevens. There are a few on-line tutorials; including a "Quick and Dirty Primer on Unix Sockets", a "networking trail" in Sun's main Java tutorial, and an early Javaworld tutorial. Educational sites with tutorials include Grinnel college where H. Walker has a guide to sockets programming in C.

WWW, HTML, and CGI

You must have read enough about the World Wide Web and the growth of HTML, HTTP, browsers and so forth. If you haven't, then this material at Yahoo should satiate you (but don't be surprised if many of the links prove to be broken).

The specification for CGI is on-line. Yahoo offers a large set of links to tutorials and background information on CGI. The tutorials illustrate CGI programming with C, and Perl.

There are web tutorials covering the use of HTML forms. These include the W3Schools examples, and some at Internet.com. Examples relating to forms are included in the materials associated with Appendix A of this text.

SSI: Server Side Includes

Server side includes were about the first effective mechanism for generating dynamic pages. Once again, Yahoo has a section with links to sites covering SSI. Tutorials include one at WDVL; the original tutorial documentation for the 1995 NCSA server (the unpatched Apache) is still around, and contains some notes on SSI. Your Apache web server documentation includes a current version; this material can also be accessed on-line.

SSI provided the initial inspiration for the Microsoft's Active Server Pages (.NET is much more sophisticated). Yahoo naturally has links to major sites covering ASP programming. The Cold Fusion server side scripting environment also really evolved from SSI.

Example C++ CGI programs

Annotated code listings for the C++ CGI code used in the text are available, along with other materials relating to the "pizza order" example.

Javascript

Using Javascript (scripting on the browser) to check data prior to form submission is an efficiency optimization. If you can catch bad data prior to submission, you can avoid the overhead of submitting form data that will only be rejected by your server. It won't usually be worthwhile including such Javascript checks in form pages that you create for learning exercises, but you should make sure that you know how it can be done so that you can use Javascript data checking as appropriate in real world applications.

An annotated example is provided for the Javascript code used to check the "pizza order". Web tutorials are as ever available at W3Schools, and at WDVL. Yahoo has a Javascript section in its "Programming Languages" category.