SocketServer and Ctrl-C on Windows
eryk sun
eryksun at gmail.com
Mon Apr 3 08:59:18 EDT 2017
On Mon, Apr 3, 2017 at 12:34 PM, Paul Moore <p.f.moore at gmail.com> wrote:
> On Monday, 3 April 2017 13:23:11 UTC+1, eryk sun wrote:
>> It works for me when run from a command prompt in Windows 10.
>> serve_forever() uses select() with a timeout of 0.5s, so it doesn't
>> block the main thread.
>
> Odd. For me, it doesn't work (Windows 7, but I can't see why that would affect it).
>
> Having investigated a bit more, it seems like if I just start the server then hit Ctrl-C
> it shuts down fine. But if I start the server, then I navigate to http://localhost:8000 in
> my browser, and *then* hit Ctrl-C, the server just continues running.
It should service the request and return to the serve_forever() loop.
Do you see a line logged for each request, like "[IP] - - [date] "GET
..."?
More information about the Python-list
mailing list