Minimal HTTP time server/client

These implement a minimal HTTP client and server which input and output the current time at the server (GMT). bigserver.py is a more legible/extensible form of minserver.py. This is only demo code. A very similar but slightly more complicated version is available in the "Network Protocols" (pdf) section of Fredrik Lundh's "The Standard Python Library" book, which implements an actual standard (ifl:)RFC 868.

If you find this of interest, Bruce Eckel has done a nice example of using many Python standard library tools together to expose a database as a webpage from a local HTTP server, here, explained here.

If you wanted sockets code, the documentation for the socket module has an example of an echo server and client. (Incidentally, here's a nice Tiny C++ webserver.)

There's a nice article on using a load of unpleasant technologies together here (serving up XML to a Flash front-end, with some ASP for bad measure).

Here's A list of open-source HTTP proxies written in python.

Echo clients/servers at the Great Programming Language Shootout.

Armin Rigo, the scarily smart chap behind Psyco, has a mini-webserver script at http://codespeak.net/svn/user/arigo/hack/misc/httpserver.py. The other things in the same folder and at codespeak.net itself are worth a look too.

There's another simple python webserver, Glass, at http://aquarium.sourceforge.net/glass/, and another at cookbook recipe 392879

Python Cookbook Recipe 440665 is a simple Asynchronous HTTP server.