Re: How to shut down a TCPServer serve_forever() loop?

2017-11-28 Thread Ian Kelly
On Tue, Nov 28, 2017 at 11:54 AM, Marko Rauhamaa wrote: > Chris Angelico : >> Would the OP have been trivially able to send a signal to the >> process? Yes. > >Python signal handlers are always executed in the main Python thread, >even if the signal was

Re: How to shut down a TCPServer serve_forever() loop?

2017-11-28 Thread Marko Rauhamaa
Chris Angelico : > On Wed, Nov 29, 2017 at 5:32 AM, Marko Rauhamaa wrote: >> Don't you worry about my programs. > > Okay, but you can't claim that problems are solvable if you cheat them. What I'm saying is that there's no particular reason why glibc couldn't

Re: How to shut down a TCPServer serve_forever() loop?

2017-11-28 Thread Chris Angelico
On Wed, Nov 29, 2017 at 5:32 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Wed, Nov 29, 2017 at 5:03 AM, Marko Rauhamaa wrote: >>> Chris Angelico : Do you respect /etc/nsswitch.conf? >>> >>> No, but I don't need

Re: How to shut down a TCPServer serve_forever() loop?

2017-11-28 Thread Marko Rauhamaa
Chris Angelico : > On Wed, Nov 29, 2017 at 5:03 AM, Marko Rauhamaa wrote: >> Chris Angelico : >>> Do you respect /etc/nsswitch.conf? >> >> No, but I don't need to. > > Ah, right. Until the day you're wrestling with "why doesn't /etc/hosts >

Re: How to shut down a TCPServer serve_forever() loop?

2017-11-28 Thread Chris Angelico
On Wed, Nov 29, 2017 at 5:03 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Wed, Nov 29, 2017 at 4:22 AM, Marko Rauhamaa wrote: >>> I have solved the gethostbyname() problem by implementing the DNS >>> protocol myself (in Python). >> >>

Re: How to shut down a TCPServer serve_forever() loop?

2017-11-28 Thread Marko Rauhamaa
Chris Angelico : > On Wed, Nov 29, 2017 at 4:22 AM, Marko Rauhamaa wrote: >> I have solved the gethostbyname() problem by implementing the DNS >> protocol myself (in Python). > > Do you respect /etc/nsswitch.conf? No, but I don't need to. >>> I don't

Re: How to shut down a TCPServer serve_forever() loop?

2017-11-28 Thread Chris Angelico
On Wed, Nov 29, 2017 at 4:22 AM, Marko Rauhamaa wrote: > I have solved the gethostbyname() problem by implementing the DNS > protocol myself (in Python). Do you respect /etc/nsswitch.conf? >> I don't understand why you keep insisting that asyncio and threads are >> somehow

Re: How to shut down a TCPServer serve_forever() loop?

2017-11-28 Thread Marko Rauhamaa
Chris Angelico : > On Tue, Nov 28, 2017 at 11:52 PM, Marko Rauhamaa wrote: >> The original poster's problem seems to be caused by blocking APIs that >> cannot be multiplexed using select(). A good many Python facilities are >> the same way. >> >> Such

Re: How to shut down a TCPServer serve_forever() loop?

2017-11-28 Thread Chris Angelico
On Tue, Nov 28, 2017 at 11:52 PM, Marko Rauhamaa wrote: > Chris Angelico : > >> On Tue, Nov 28, 2017 at 5:04 PM, Marko Rauhamaa wrote: >>> Seems to be one of the fundamental multithreading issues: each thread >>> is blocked on precisely one

Re: How to shut down a TCPServer serve_forever() loop?

2017-11-28 Thread Marko Rauhamaa
Chris Angelico : > On Tue, Nov 28, 2017 at 5:04 PM, Marko Rauhamaa wrote: >> Seems to be one of the fundamental multithreading issues: each thread >> is blocked on precisely one event. Asyncio is more flexible: you can >> multiplex on a number of events. > >

Re: How to shut down a TCPServer serve_forever() loop?

2017-11-28 Thread Chris Angelico
On Tue, Nov 28, 2017 at 5:04 PM, Marko Rauhamaa wrote: > Ian Kelly : > >> On Sat, Nov 25, 2017 at 7:10 AM, John Pote >> wrote: >>> The issue is that if I press a key on the keyboard the key is >>> immediately shown on the

Re: How to shut down a TCPServer serve_forever() loop?

2017-11-27 Thread Marko Rauhamaa
Ian Kelly : > On Sat, Nov 25, 2017 at 7:10 AM, John Pote wrote: >> The issue is that if I press a key on the keyboard the key is >> immediately shown on the screen but then the shutdown() call blocks >> until another TCP connection is made, text

Re: How to shut down a TCPServer serve_forever() loop?

2017-11-27 Thread Ian Kelly
On Sat, Nov 25, 2017 at 7:10 AM, John Pote wrote: > Hi all, > > My problem in summary is that my use of the shutdown() method only shuts > down a server after the next TCP request is received. > > I have a TCP server created in the run() method of a thread. > >