oops - reading my mail in the reverse order :)

Generally a program like this will spawn a new thread to run the "real" (ie,
SOAP) server in.  The services main thread then simply waits for a shutdown
request from Windows, and asks the server to shut down.  As it is in another
thread, it can sleep for 5 seconds or so to give it the chance, then just
finish anyway (effectively killing the thread).  [Note that this also
implies you can *skip* the 'attempt to shutdown soap' part, and just have
the server be killed as the service goes down - it works, and I suspect is
what other solutions would do]

The trick then is to find how to shut down the server itself.  As I don't
know SOAPpy I can't offer specific advice.  A common problem in this
scenario is that the server will be blocked on a 'select' call - so even if
a "stop" flag has been set, the server will not see it until select returns.
A common way around this is for the service shutdown itself set the flag,
then to make a local connection to the server - just enough to wake the
select so the server can see it is being asked to shut down.  Alternatively,
that select() call may have a timeout associated with it - in that case, you
could simply wait the timeout period (plus a bit) before killing the server.

Mark

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf
Of Paul Weimer
Sent: Tuesday, September 27, 2005 2:29 AM
To: [EMAIL PROTECTED]; [email protected]
Subject: [python-win32] Using SOAPpy Within a Windows NT service


I have a web service written in SOAPpy that is working fine; it is currently
run from a batch file as a scheduled task on a WIndows server. My support
folks would like it to be run as an NT service. I have been able to write NT
service in Python before but I'm not having much luck interupting the SOAP
server when it's waiting for reaquests. Any ideas?

Paul Weimer

_______________________________________________
Python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to