emulating

Is out there any sample of reading http requests using TCP socket collecting data from them (like emulating Http server in some way)

Is out there any sample of reading http requests using TCP socket collecting data from them (like emulating Http server in some way) so I wanna to keep data like senders IP:PORT, request body and so on. So has any one seen such thing in OpenSource projects or do you know how to create it? (if so please provide siple code example) ...

I'd like to know what's going on this Python program. I've included the code.

Here's the code: http://paste.pocoo.org/show/238093/ My main questions right now are: Is Line 37 mainly the gist of this program? And does it simply calculate this once and then print the result? Ex: self.start + key*self.step with start=1, key=4, step=2 [prints 9] where does the variable 'value' actually come into play here? Line 39....