Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #96295

Re: Signal SIGINT ignored during socket.accept

Path csiph.com!news.mixmin.net!newsreader4.netcologne.de!news.netcologne.de!bcyclone01.am1.xlned.com!bcyclone01.am1.xlned.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:skip:s 10': 0.05; 'option,': 0.07; 'cc:addr:python-list': 0.09; 'addr': 0.09; 'block.': 0.09; 'python': 0.10; 'control-c': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'poll': 0.16; 's.accept()': 0.16; 'silly': 0.16; 'sock,': 0.16; 'socket.': 0.16; 'worst': 0.16; 'wrote:': 0.16; 'instance,': 0.18; 'tests.': 0.18; 'versions': 0.20; 'windows': 0.20; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'work,': 0.21; 'fairly': 0.22; '(by': 0.22; 'sep': 0.22; 'trying': 0.22; 'am,': 0.23; '(most': 0.24; 'thus': 0.24; 'unix': 0.24; 'header:In-Reply- To:1': 0.24; 'install': 0.25; "doesn't": 0.26; 'skip:" 20': 0.26; 'fri,': 0.27; 'separate': 0.27; 'message-id:@mail.gmail.com': 0.27; 'connects': 0.27; 'blocking': 0.29; 'code': 0.30; "can't": 0.32; 'possibly': 0.32; 'maybe': 0.33; 'run': 0.33; 'problem': 0.33; 'though.': 0.33; 'traceback': 0.33; 'windows.': 0.33; 'case,': 0.34; 'file': 0.34; 'server': 0.34; 'gives': 0.35; 'received:google.com': 0.35; 'something': 0.35; 'but': 0.36; 'there': 0.36; 'possible': 0.36; 'subject:: ': 0.37; "won't": 0.38; 'or,': 0.38; 'test': 0.39; 'does': 0.39; "didn't": 0.39; 'rather': 0.39; 'chance': 0.60; 'your': 0.60; 'show': 0.62; 'different': 0.63; 'grab': 0.64; 'worth': 0.67; 'yourself': 0.73; '3.4': 0.84; 'all;': 0.84; 'chrisa': 0.84; 'grabbing': 0.84; 'recognition': 0.84; 'researching': 0.84; 'to:none': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=2XUwYwkrIqH321yjFwRYXUgtlXhrONj/mXNPLQF3KBY=; b=Bi4c1Jq0WItRqDDQLcQEu/G+67/+xszEsDDeNvNdtuWc9U2xcWkdm40uXgig8g1buk 4p8YC4vlA1tP2eNFiE7dRvj9PPiqmGIzJE61B284dHRD95NgPDC6390bJ7+f4m2qcpi0 5dQjic4mJdrHQKvYyWmeFFSnjN+xv+AproHzQnPa7049VTJL0Xgh+KvXZhxO05z2+YhV lXzXjGUKU3DDMr9XmTsrhxs+8d+27Gq2QWYSSg46bYx2jJs5HwCFJW8Yg9TgLT1MGW8J DwrbtiCWq8l4jEmkZIsqvnouq20M8AAeis8waBRU+tkL4a1if6f1rwzdtfFQBTPfcOs8 5bcA==
MIME-Version 1.0
X-Received by 10.50.3.66 with SMTP id a2mr9500117iga.92.1441913187471; Thu, 10 Sep 2015 12:26:27 -0700 (PDT)
In-Reply-To <msskh1$j00$1@dont-email.me>
References <msshpm$7pn$1@dont-email.me> <mailman.332.1441910212.8327.python-list@python.org> <msskh1$j00$1@dont-email.me>
Date Fri, 11 Sep 2015 05:26:27 +1000
Subject Re: Signal SIGINT ignored during socket.accept
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.337.1441913195.8327.python-list@python.org> (permalink)
Lines 39
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1441913195 news.xs4all.nl 23803 [2001:888:2000:d::a6]:55975
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 5309
X-Received-Body-CRC 2875526266
Xref csiph.com comp.lang.python:96295

Show key headers only | View raw


On Fri, Sep 11, 2015 at 5:11 AM, James Harris <james.harris.1@gmail.com> wrote:
> S:\>python socktest.py
> Traceback (most recent call last):
>  File "socktest.py", line 6, in <module>
>    endpoint = s.accept()
>  File "C:\Python27\lib\socket.py", line 202, in accept
>    sock, addr = self._sock.accept()
> KeyboardInterrupt
>
> S:\>
>
> However, on Windows the recognition of Control-C does not happen until after
> something connects to the socket.
>
> I will carry on researching it but maybe the above gives a clue to those in
> the know...!

This is a known problem on Windows. I can't remember what the best
solution was, but there's a chance something got into 2.7.10, as it
was fairly recent. There's a significantly better chance that
something's different in Python 3.x. You may find it worth grabbing a
few different versions of Python and trying the same code on all of
them.

You may run into issues with XP, though. For instance, Python 3.5
doesn't support it, and (IIRC) won't install at all; 3.4 does work, as
will all releases of 2.7.x. Worst case, grab yourself a Windows 7 and
try a few tests.

But a quick test on one of my VMs, with 3.4 on Win 7, didn't show any
change. It's entirely possible that a blocking socket-accept call will
continue to block. There is one rather silly option, and that's to use
select() to effectively poll for Ctrl-C... or, possibly better, have a
separate program that shuts down your server (by connecting to it,
which thus breaks the stranglehold).

Of course, switching over to Unix is also a good option...

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Signal SIGINT ignored during socket.accept "James Harris" <james.harris.1@gmail.com> - 2015-09-10 19:24 +0100
  Re: Signal SIGINT ignored during socket.accept Chris Angelico <rosuav@gmail.com> - 2015-09-11 04:36 +1000
    Re: Signal SIGINT ignored during socket.accept "James Harris" <james.harris.1@gmail.com> - 2015-09-10 20:11 +0100
      Re: Signal SIGINT ignored during socket.accept Chris Angelico <rosuav@gmail.com> - 2015-09-11 05:26 +1000
        Re: Signal SIGINT ignored during socket.accept "James Harris" <james.harris.1@gmail.com> - 2015-09-10 21:12 +0100
          Re: Signal SIGINT ignored during socket.accept Chris Angelico <rosuav@gmail.com> - 2015-09-11 12:01 +1000
            Re: Signal SIGINT ignored during socket.accept Grant Edwards <invalid@invalid.invalid> - 2015-09-11 13:50 +0000
              Re: Signal SIGINT ignored during socket.accept Marko Rauhamaa <marko@pacujo.net> - 2015-09-11 17:00 +0300
              Re: Signal SIGINT ignored during socket.accept Chris Angelico <rosuav@gmail.com> - 2015-09-12 00:27 +1000
              Re: Signal SIGINT ignored during socket.accept "James Harris" <james.harris.1@gmail.com> - 2015-09-11 18:14 +0100
                Re: Signal SIGINT ignored during socket.accept "James Harris" <james.harris.1@gmail.com> - 2015-09-12 00:15 +0100

csiph-web