[mod_python] creating a socket using mod_python

Roberto C. Sánchez roberto at connexer.com
Thu Jul 5 18:27:53 EDT 2007

On Thu, Jul 05, 2007 at 09:00:04AM -0700, Hristo Asenov wrote:
> 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.
Please fix your mail client configuration so that it wraps lines.

It seems like what you want to do is more suited to a framework like
twisted.  That is, it seems like you have to reinvent functionality that
someone else has already implemented for you.



Roberto C. Sánchez
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070705/d65f75c9/attachment.bin

More information about the Mod_python mailing list