[issue8498] Cannot use backlog = 0 for sockets
Daniel Evers added the comment: To revive this issue, I tried to write a unit test to verify the behaviour. Onfurtunately, the test doesn't work and I don't understand why. I hope, someone here is more enlightend than me... (files: server.py, client.py) -- Added file: http://bugs.python.org/file21851/server.py ___ Python tracker <http://bugs.python.org/issue8498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8498] Cannot use backlog = 0 for sockets
Daniel Evers added the comment: (client.py) -- Added file: http://bugs.python.org/file21852/client.py ___ Python tracker <http://bugs.python.org/issue8498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8498] Cannot use backlog = 0 for sockets
Daniel Evers added the comment: Thanks for the tip. I added the unit test and uploaded my final patch (which includes all changes). Is it ok to remove the files I uploaded previously? -- Added file: http://bugs.python.org/file21879/backlog0_complete.patch ___ Python tracker <http://bugs.python.org/issue8498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8498] Cannot use backlog = 0 for sockets
Changes by Daniel Evers : Removed file: http://bugs.python.org/file17065/backlog0.diff ___ Python tracker <http://bugs.python.org/issue8498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8498] Cannot use backlog = 0 for sockets
Changes by Daniel Evers : Removed file: http://bugs.python.org/file17066/backlog0_incl_doc.diff ___ Python tracker <http://bugs.python.org/issue8498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8498] Cannot use backlog = 0 for sockets
Changes by Daniel Evers : Removed file: http://bugs.python.org/file17067/socket_listen.patch ___ Python tracker <http://bugs.python.org/issue8498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8498] Cannot use backlog = 0 for sockets
Changes by Daniel Evers : Removed file: http://bugs.python.org/file21851/server.py ___ Python tracker <http://bugs.python.org/issue8498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8498] Cannot use backlog = 0 for sockets
Changes by Daniel Evers : Removed file: http://bugs.python.org/file21852/client.py ___ Python tracker <http://bugs.python.org/issue8498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8498] Cannot use backlog = 0 for sockets
Changes by Daniel Evers : Removed file: http://bugs.python.org/file21879/backlog0_complete.patch ___ Python tracker <http://bugs.python.org/issue8498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8498] Cannot use backlog = 0 for sockets
Daniel Evers added the comment: Thanks, I removed the old patches and changed the unit test according to your suggestion. I kept the "usually 5" remark, because I'm not sure how reality really looks like. But feel free to suggest a patch ;) -- Added file: http://bugs.python.org/file21943/socket_backlog0.patch ___ Python tracker <http://bugs.python.org/issue8498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8498] Cannot use backlog = 0 for sockets
New submission from Daniel Evers : I'm trying to rewrite a server application in python that accepts exactly 1 connection. I have a previous version written in C that can call listen() on a socket with a backlog of 0 connections, but this is not possible in python. In Modules/socketmodule.c (function socket_listen) the backlog is reset to at least "1". -- components: Extension Modules messages: 103942 nosy: Daniel.Evers severity: normal status: open title: Cannot use backlog = 0 for sockets type: behavior versions: Python 2.6 ___ Python tracker <http://bugs.python.org/issue8498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8498] Cannot use backlog = 0 for sockets
Daniel Evers added the comment: Thanks for your help. I'll close the listen socket. Nevertheless I'd like to understand the check in sock_listen. The commit message is not very helpful, I agree, that's why I wrote this issue. 0 is a valid value, and I'd suggest two ways to handle this situation: 1. Always set backlog at least to 1 (like now), but make this explicit in the documentation (docs.python.org says "should be at least 1" which is not the same as "will be at least 1") 2. Allow backlog = 0 and make a note in the docs that the exact behaviour will be implementation/OS-specific. In case (1) the hint to close the listen socket should also be added to the documentation. -- ___ Python tracker <http://bugs.python.org/issue8498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8498] Cannot use backlog = 0 for sockets
Daniel Evers added the comment: I attached a patch: The backlog is set to at least 0 instead of 1. I also added a comment that a backlog < 0 can lead to problems and doesn't make sense anyway (so if there are systems that may crash with backlog < 0 this will be avoided). -- keywords: +patch Added file: http://bugs.python.org/file17065/backlog0.diff ___ Python tracker <http://bugs.python.org/issue8498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8498] Cannot use backlog = 0 for sockets
Daniel Evers added the comment: Ah right ;) Sorry, attached the path incl. the doc string. -- Added file: http://bugs.python.org/file17066/backlog0_incl_doc.diff ___ Python tracker <http://bugs.python.org/issue8498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8498] Cannot use backlog = 0 for sockets
Daniel Evers added the comment: A second patch for the documentation of socket.listen(). -- Added file: http://bugs.python.org/file17067/socket_listen.patch ___ Python tracker <http://bugs.python.org/issue8498> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com