Killing a socket server in DOS?

Magnus Lie Hetland mlh at vier.idi.ntnu.no
Fri May 31 07:31:36 EDT 2002


In article <MCHJ8.76519$%u2.4430 at atlpnn01.usenetserver.com>, Steve Holden wrote:
>"Magnus Lie Hetland" <mlh at vier.idi.ntnu.no> wrote ...
[snip]
>
>Here's a snippet using asyncore that seems to do what you want. Are you
>saying that you can't trap KeyboiardInterrupt? You'll have your own
>http_server() equivalent already, I'm guessing.
>
[snip]
>    try:
>        asyncore.loop(1.0) # Frequent checks for interrupt
>    except KeyboardInterrupt:
>        print "Completed" # on console
>        logfile.close()

I guess the use of a timeout was the problem... I simply used
asyncore.loop(). It worked in UNIX, but not in DOS (or Cygwin). So...
The low timout means that the Python loop surrounding select() will be
executed more often, thereby making it possible to interrupt it more
often?

Now, it seems I have the same problem with another server too, but
that one is written using SocketServer (SimpleXMLRPCServer, actually).
Not sure how to achieve the same there. It seems I'm not able to
interrupt its serve_forever() in DOS/Cygwin there either -- although I
can easily interrupt it in UNIX (as with asyncore).

Any similar tricks I can use there, to force it to listen for
interrupts?

--
Magnus Lie Hetland                                  The Anygui Project
http://hetland.org                                  http://anygui.org



More information about the Python-list mailing list