[Twisted-Python] How to make twisted server run as an deamon

EddyXu eddyxu at 126.com
Thu Sep 1 02:14:42 EDT 2005


The server which is in your code is inherit from
twisted.application.FOOserver? or some module else? It seems i have
wrote my server in "Low level" which has talked about in HOWTOs. For use
the foo.tac below, do i need rewrite all my server and use
twisted.application instead of the code i use now.?

Bill Bumgarner 写道:

> On Aug 31, 2005, at 7:05 PM, EddyXu wrote:
>
>> I need to write an deamon, by using the twisted. But it seems that it
>> could not use standard thread module to make it works. Any one can give
>> me some advice?
>
>
> You will most likely want to use twistd and write a .tac file that
> starts up your server. Twistd will take care of daemonizing and is
> really quite nice.
>
> --- foo.tac ---
> from twisted.application import service, internet
> import Foo # your server
>
> application = service.Application("foo")
> applicationService = service.IServiceCollection(application)
>
> server = internet.TCPServer(Foo.serverPort(), Foo.serverFactory())
> server.setServiceParent(applicationService)
> --- end foo.tac ---
>
> Except that it doesn't allow command line arguments to be passed in.
> Bummer. Easy to fix, though, I really ought to write up a recipe for
> doing so.
>
> b.bum
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>


-- 
No more than thinking....







More information about the Twisted-Python mailing list