Re: Signal SIGINT ignored during socket.accept

2015-09-11 Thread James Harris
"James Harris" wrote in message news:msv21t$n1m$1...@dont-email.me... "Grant Edwards" wrote in message news:msum6c$hv$1...@reader1.panix.com... ... Waking up twice per second and immediately calling select() again on any hardware/OS built in the past 50 years is going completely negligi

Re: Signal SIGINT ignored during socket.accept

2015-09-11 Thread James Harris
"Grant Edwards" wrote in message news:msum6c$hv$1...@reader1.panix.com... On 2015-09-11, Chris Angelico wrote: This is what I meant when I said you would be polling. Effectively, you wake up your program every half-second, check if Ctrl-C has been pressed, and if it hasn't, you go back to s

Re: Signal SIGINT ignored during socket.accept

2015-09-11 Thread Chris Angelico
On Fri, Sep 11, 2015 at 11:50 PM, Grant Edwards wrote: > On 2015-09-11, Chris Angelico wrote: > >> This is what I meant when I said you would be polling. Effectively, >> you wake up your program every half-second, check if Ctrl-C has been >> pressed, and if it hasn't, you go back to sleep again.

Re: Signal SIGINT ignored during socket.accept

2015-09-11 Thread Marko Rauhamaa
Grant Edwards : > On 2015-09-11, Chris Angelico wrote: >> This is what I meant when I said you would be polling. Effectively, >> you wake up your program every half-second, check if Ctrl-C has been >> pressed, and if it hasn't, you go back to sleep again. This is pretty >> inefficient. > > Though

Re: Signal SIGINT ignored during socket.accept

2015-09-11 Thread Grant Edwards
On 2015-09-11, Chris Angelico wrote: > This is what I meant when I said you would be polling. Effectively, > you wake up your program every half-second, check if Ctrl-C has been > pressed, and if it hasn't, you go back to sleep again. This is pretty > inefficient. Though it offends one's enginee

Re: Signal SIGINT ignored during socket.accept

2015-09-10 Thread Chris Angelico
On Fri, Sep 11, 2015 at 6:12 AM, James Harris wrote: > Thanks for your help, Chris. Using select() is a very good option. I tried > first without a timeout and even then this version of Windows does not > recognise Control-C until after the select() call returns (which needs > similar prompting as

Re: Signal SIGINT ignored during socket.accept

2015-09-10 Thread James Harris
"Chris Angelico" wrote in message news:mailman.337.1441913195.8327.python-l...@python.org... On Fri, Sep 11, 2015 at 5:11 AM, James Harris wrote: ... However, on Windows the recognition of Control-C does not happen until after something connects to the socket. ... This is a known pro

Re: Signal SIGINT ignored during socket.accept

2015-09-10 Thread Chris Angelico
On Fri, Sep 11, 2015 at 5:11 AM, James Harris wrote: > S:\>python socktest.py > Traceback (most recent call last): > File "socktest.py", line 6, in >endpoint = s.accept() > File "C:\Python27\lib\socket.py", line 202, in accept >sock, addr = self._sock.accept() > KeyboardInterrupt > > S:

Re: Signal SIGINT ignored during socket.accept

2015-09-10 Thread James Harris
"Chris Angelico" wrote in message news:mailman.332.1441910212.8327.python-l...@python.org... On Fri, Sep 11, 2015 at 4:24 AM, James Harris wrote: I have a listening socket, self.lsock, which is used in an accept() call as follows endpoint = self.lsock.accept() The problem is that if cont

Re: Signal SIGINT ignored during socket.accept

2015-09-10 Thread Chris Angelico
On Fri, Sep 11, 2015 at 4:24 AM, James Harris wrote: > I have a listening socket, self.lsock, which is used in an accept() call as > follows > > endpoint = self.lsock.accept() > > The problem is that if control-C is pressed it is not recognised until > something connects to that socket. Only when

Signal SIGINT ignored during socket.accept

2015-09-10 Thread James Harris
I have a listening socket, self.lsock, which is used in an accept() call as follows endpoint = self.lsock.accept() The problem is that if control-C is pressed it is not recognised until something connects to that socket. Only when the accept() call returns is the signal seen. The question,