[Twisted-Python] NT Service

Thad Jacobs tjacobs at kinematic.com
Wed Mar 5 16:35:03 EST 2003

Works like a charm!!  Thanks, Donovan

-----Original Message-----
From: Donovan Preston [mailto:dp at twistedmatrix.com]
Sent: Wednesday, March 05, 2003 1:19 PM
To: twisted-python at twistedmatrix.com
Subject: Re: [Twisted-Python] NT Service

On Wednesday, March 5, 2003, at 01:01 PM, Thad Jacobs wrote:

[ snip snip ]

> def startTwisted():
>    from twisted.internet.app import Application
>    #How do I specify a port or load a tap file?
>    app = Application("web")

     # This is for creating a web root and listening on a port manually;
     # You could also probably load a tap but I don't know how.
     from twisted.web import server, static
     root = server.Site(static.File("c:\\web"))

     app.listenTCP(8080, site)

>    app.run(save=0)
>    print "Finished"
> if __name__=='__main__':
>    # you could call startTwisted to run as not-a-service
>    # or use it for cross-platform reasons
>    win32serviceutil.HandleCommandLine(KAQueryService)

mktap does the bit of code where you create the Site and File instances 
and call listenTCP. A good goal for making twisted better on windows 
(low on most priority lists since most of the twisted developers don't 
use windows) would be some sort of way to say "install this TAP as a 
service" which basically runs all that boilerplate; I have no idea 
about any of the details of how this would work though.

Hope this helps.


Twisted-Python mailing list
Twisted-Python at twistedmatrix.com

More information about the Twisted-Python mailing list