[mod_python] creating a socket using mod_python

Hristo Asenov njvsny at yahoo.com
Thu Jul 5 12:00:04 EDT 2007

i am just starting to get acquainted with modpython and it is very interesting. what I already have build is a socket listening on one port, and then a client connecting to it through another computer. The client sends shell commands to the server, the server executes those commands, and responds with the output. It is something like a telnet or ssh program, but built from the ground up. Anyways, I would like to make a web-based interface for it, where I can type a command into a form, send it, and get a response. I have managed to open a socket, send the command, receive the output, and then close the socket. However, in order this to work properly, my client needs to be running as a daemon, in a continuous loop, otherwise it looses its current working directory. modpython.publisher cannot do this, since it returns a value and I can't return and terminate the program running in the background. I tried using req.write() also, but that doesn't work either since it needs to
 return with apache.OK in order for req.write() to be displayed. Is there any other other way I could get this working. I was thinking of maybe having that program run in the background, and then build another socket that connects to that program temporarily, but seems like too much redundancy. I was either thinking of rather than write to screen, the program could write to file temporarily, and then modpython could read from there. However, there might be a better solution using modpython that I am not aware of yet.

Sick sense of humor? Visit Yahoo! TV's Comedy with an Edge to see what's on, when. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070705/bf0de43d/attachment.html

More information about the Mod_python mailing list