Simple TCP Server || Daemonize || Continuous
Andrew Bennetts
andrew-pythonlist at puzzling.org
Tue Feb 4 05:44:11 EST 2003
On Tue, Feb 04, 2003 at 05:10:09AM -0500, Metnetsky wrote:
> I found the following code courtesy of the great Python docs (thank you
> whomever). I was wondering what I might have to do in order to turn this
> simple TCP-server into a *nix daemon, and how to keep the server accepting
> continuous connections. I tried playing around with the code to keep it
> going, but I'm apparently not completely understanding the code (which I'm
> sure I can get). The big thing here is the transformation into a daemon.
> How can I make this python script fork itself away from it's parent?
The easiest way, in my opinion, is to let a library like Twisted do it for
you.
http://twistedmatrix.com/documents/howto/plugin
http://twistedmatrix.com/documents/howto/servers
Twisted will handle concurrent connections and daemonisation for you, and
lots more. What sort of server do you want to write?
-Andrew.
More information about the Python-list
mailing list