[mod_python] webinterface for a local telnet server

Sean Davis sdavis2 at mail.nih.gov
Fri Oct 6 09:21:18 EDT 2006

On Friday 06 October 2006 08:37, Andreas Klauer wrote:
> Hello mod_python,
> I'm new to this list, I hope I'm not asking something too obvious.
> I want to write a web frontend for a local telnet server in mod_python.
> Now, I thought it would be an easy task, but it is slowly turning out
> not to be that easy. The very small rudimentary script I wrote opens a
> telnet connection to the server. It accepts commands from the browser
> and sends them to the server, and sends replies back to the browser.
> This would all work very well if it were not for Apache threads. I need
> one telnet connection per user (identified by Session), but when Apache
> starts another thread, anything that is not stored on the outside (file,
> database, ...) is, well not really lost, as the other thread still has
> the information, but it is unavailable to the new thread.
> That leads me to the question. What's the best way to write a web app,
> when I need data per user (session) that can not be stored on disk, for
> example a persistent connection to a telnet or IRC server. Unfortunately
> the server does not support sharing connections for multiple clients
> like databases do. It also does not support concurrent connections for
> the same user, so creating one connection per thread is not an option.
> I see that FastCGI has an 'Session Affinity' patch, which is supposed to
> take care of the problem. They solved the problem by giving their module
> some control over which thread to use. However this patch never made it
> into the distribution and does not seem very actively maintained (never
> tested with Apache2 according to their homepage).
> The only alternative I see is to write yet another intermediator daemon
> which I have to put in between the server and mod_python which then takes
> care of the connections in a smart way (persistent connection to the
> mod_python threads which can then be shared by the users or whatever).
> Needless to say this would make things much more complicated than they
> need to be, as mod_python by itself can already do persistent connections,
> just not in the correct threads.
> How to proceed?

Could you put in a persistent backend daemon that your mod_python processes 
can talk to, which knows the mapping from user to connection?  


More information about the Mod_python mailing list