[Twisted-Python] mktap/twistd in a Windows service

Paul Moore pf_moore at yahoo.co.uk
Sun Nov 4 12:52:35 EST 2007

I know this is a FAQ, but it's not in the FAQ list and I've had no luck 
finding a good answer via web or list searches (Windows is a lousy 
search term, and service isn't much use in a Twisted context...)

I want to run a tiny non-authoritative DNS server on my PC. I've never 
done this before, but twisted names looks ideal. The documentation 
says I just need to do

     mktap dns --recursive --cache
     twistd -f dns.tap

and indeed this works fine. I seem to recall some time ago seeing 
postings to the effect that tap format files were out of favour, but I 
don't follow the twisted list much, so I don't know if this is still 
true. Nevertheless, it works so who cares?

However, I want to run this as a Windows service. Ideally, twistd would 
have a --install-service flag or something, but it doesn't so I went 
looking, and found postings covering tap2ntsvc which creates services 
from tap files, but it seems to have been replaced by ntsvc, which only 
handles .tac files :-(

I get the impression that the idea is that .tac files are easy to create 
by hand, but as I know *nothing* about twisted names (and don't really 
want to - all I want is to run a DNS server!) it's not as easy as it 
might be...

So, can someone tell me:

1. What is the currently favoured form for Twisted application files?
2. How do I make one for twisted names (the equivalent of the mktap line 
above) and better still how do I generalise this for any mktap command?
3. How do I run it? (twistd, presumably)
4. How do I make that file run as a Windows service?

I believe, from what I've found, that the answers are:
1. .tac
2. Don't know - not sure there's a generic answer.
3. twistd -noy
4. ntsvc

In which case, the documentation really needs to be updated to explain 
.tac files throughout, instead of mktap. And I need someone to write me 
a dns.tac file :-(

Ideally, this should be written up as a FAQ or HOWTO somewhere. I'll 
volunteer to write it up, as long as someone will maintain it - I'm not 
in a position to do so (I use twisted occasionally, but have no need or 
desire to follow development versions or discussions on the list). I 
don't want to bother doing a write-up, if it won't get included in the 
docs/FAQ and maintained, though...

Thanks in advance for any help,

More information about the Twisted-Python mailing list