<-- back to index...

CSE 142 : The NAW Server

You don't currently know how to write a web server. A web server needs all kinds of networking code and lots of other junk. However, the basic idea behind a web server is very simple:

  1. Wait for someone to ask for a page.
  2. When someone asks for a page:
    1. Figure out what page they're asking for.
    2. Send that page to the place (entity, program, person) that asked for it.
  3. Go back to step 1.

You have (or will soon have) all the tools you need to implement a program that does something very much like the above. We'll start out with something very simple and, over the course of the quarter, gradually build it up. By the way, we'll write the whole thing in class.

Since it's not a web server, we'll call it "Not A Web server", or "NAW server" for short. We don't know how to get network requests, so we'll get input from the keyboard. In most other respects, however, it will be a lot like a web server.

So, without further ado, here are the lessons:

  1. Session 1: Writing an event loop, and handing requests.
    Solutions and notes: Student solutions to the problems, and further notes for the curious.
  2.  
     
  3. Session 2:
    Adding single-user authentication; using pointers.
    Worksheet:
    A scratch page with room for your answers.
    Solutions and notes:
    Sample solutions to each exercise.
    session-2-start.c:
    A compilable version of the starter code in the worksheet.
    session-2-final.c:
    Final, compilable code, with all three exercises completed. You should also look at the solutions page for incremental solutions to each exercise, which may be easier to understand

Keunwoo Lee
Last modified: Fri Nov 5 15:43:22 PST 1999