windows service

  • Thread starter Michael Chesterton
  • Start date
M

Michael Chesterton

I'm trying to get a program that uses M2Crypto ThreadingSSLServer to
run in windows as a service. I have a few problem, it doesn't listen
on its port and I don't know how to debug it.

I used the pipeservice example as a framework to get it running as a
service

def SvcDoRun(self):
# Write an event log record - in debug mode we will also
# see this message printed.
servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STARTED,
(self._svc_name_, '')
)

daemonserver = do_daemon()
while 1:
daemonserver.handle_request()

I think I need a way to break out of that while loop when a service
stop is sent, but not knowing what happening at that point I'm not
sure how. It's not even listening on its port.

daemonserver is

daemonserver = SSL.ThreadingSSLServer((host_ip_addr, int
(host_port_num)), TestRequestHandler, ctx)

any help?
 
K

kyosohma

I'm trying to get a program that uses M2Crypto ThreadingSSLServer to
run in windows as a service. I have a few problem, it doesn't listen
on its port and I don't know how to debug it.

I used the pipeservice example as a framework to get it running as a
service

def SvcDoRun(self):
# Write an event log record - in debug mode we will also
# see this message printed.
servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STARTED,
(self._svc_name_, '')
)

daemonserver = do_daemon()
while 1:
daemonserver.handle_request()

I think I need a way to break out of that while loop when a service
stop is sent, but not knowing what happening at that point I'm not
sure how. It's not even listening on its port.

daemonserver is

daemonserver = SSL.ThreadingSSLServer((host_ip_addr, int
(host_port_num)), TestRequestHandler, ctx)

any help?

Before you get it going as a service, test it as just a regular Python
script. I've created local servers using CherryPy before and been able
to test them. I recommend you do the same with yours before changing
it to a service.

If you have a firewall installed (which you should), you may need to
allow your program access through it. I've occasionally had to allow
localhost with some of the more stringent firewalls.

I found this post on creating a Windows Service for Windows 2000,
which can probably be modified for XP:
http://agiletesting.blogspot.com/2005/09/running-python-script-as-windows.html

There's also this one: http://essiene.blogspot.com/2005/04/python-windows-services.html

They both sound different from the way you did it, but maybe I
misunderstood.

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top