Otherwise, a security error is returned to the client. If opening the file fails, an error message is sent to the client. A buffer large enough to hold the file contents is allocated, and the file is copied into the buffer. When the copy is complete, the file is closed. The response tells the client that its request is OK and lists the proper MIME type and size of the accompanying document.
MIME types allow the browser to identify the type of document being returned.
That explains the basic functionality of Charlotte. By using a separate thread for each client request, blocking is eliminated between each client connection. Thread synchronization using a Critical Section allows each thread to write its output to stdout without the concern of corrupting the output. I tested Charlotte on both single and dual processor machines running Windows NT 4.0 Workstation and Server. Except for a few Win32 SDK calls, the source code should be easy to port to any operating system compatible with Berkeley Sockets.