closing a "forever" Server Socket

alessandro dilbert01 at gmail.com
Mon Jan 22 11:13:05 EST 2007


thanks

infact the server_forever() method is only a serve() method inside an
infinite loop.

many thanks again,

Alessandro

Matimus ha scritto:

> > I want to ask if someone knows a better way for closing a "forever
> > server" or if there is a lack in my design.
>
> Generally you don't create a 'forever server'. You create an 'until I
> say stop' server. I would do this by looking at the 'serve_forever'
> method, and implementing my own 'serve_until_?' method that is similar,
> but will stop if a flag is set. Then you have to create a method for
> setting that flag. It could be as simple as a keypress, or you could
> add a quit method to your dispatcher that sets the flag when a certain
> address is visited. That second method probably needs some added
> security, otherwise anybody can just visit 'your.server.com/quit' and
> shut it down.




More information about the Python-list mailing list