[issue12977] socket.socket.setblocking does not raise exception if no data available
Georg Brandl ge...@python.org added the comment: I think you're mistaking a closed connection with no data available. Small demo that this works as intended: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('localhost', 1234)) s.recv(10) ^CTraceback (most recent call last): File stdin, line 1, in module KeyboardInterrupt s.setblocking(False) s.recv(10) Traceback (most recent call last): File stdin, line 1, in module socket.error: [Errno 11] Resource temporarily unavailable The corresponding server: x = socket.socket(socket.AF_INET, socket.SOCK_STREAM) x.bind(('', 1234)) x.listen(1) x.accept() (socket._socketobject object at 0x7f4211e997c0, ('127.0.0.1', 39146)) -- nosy: +georg.brandl resolution: - works for me status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12977 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12977] socket.socket.setblocking does not raise exception if no data available
New submission from Florian Ludwig flor...@leijuna.de: The documentation states: In non-blocking mode, if a recv() call doesn’t find any data, [...], a error exception is raised; [0] Which is wrong. If no data is available recv() does not raise an exception but returns an empty string. [0] http://docs.python.org/library/socket.html#socket.socket.setblocking -- assignee: docs@python components: Documentation messages: 144024 nosy: Florian.Ludwig, docs@python priority: normal severity: normal status: open title: socket.socket.setblocking does not raise exception if no data available versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12977 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com