[Twisted-Python] A non-blocking socket operation could not be completed immediately

I tried this code: ----------------------------------------- from twisted.spread import pb from twisted.internet import reactor class Echoer(pb.Root): def remote_echo(self, s): return s if __name__ == "__main__": reactor.listenTCP(8001, pb.PBServerFactory(Echoer())) reactor.run() ----------------------------------------- On Windows XP all is ok. On Windows 7 64 I receive this error message: ----------------------------------------- C:\Program Files (x86)\Python\lib\site-packages\twisted\spread\pb.py:30: DeprecationWarning: the md5 module is deprecated; use hashlib instead import md5 Traceback (most recent call last): File "C:\Users\bob\Documents\Twisted\pbs.py", line 11, in <module> reactor.listenTCP(8001, pb.PBServerFactory(Echoer())) File "C:\Program Files (x86)\Python\lib\site-packages\twisted\internet\posixbase.py", line 356, in listenTCP p.startListening() File "C:\Program Files (x86)\Python\lib\site-packages\twisted\internet\tcp.py", line 862, in startListening self._realPortNumber = skt.getsockname()[1] File "<string>", line 1, in getsockname socket.error: [Errno 10035] A non-blocking socket operation could not be completed immediately ----------------------------------------- What can I do?

On Wed, 2009-11-18 at 06:03 -0800, Tommaso Mazzafico wrote:
1. Please file a bug at http://twistedmatrix.com/ - include version of Twisted, whether you have firewall of some sort, etc., so we can make sure this gets fixed. 2. Try patching the code so it does: from twisted.internet.util import untilConcludes self._realPortNumber = untilConcludes(lambda: skt.getsockname()[1]) Does this fix it? If it does, add this info to the bug. 3. Another thing to try is the IOCP reactor. -Itamar

--- On Wed, 11/18/09, Itamar Turner-Trauring (aka Shtull-Trauring) <itamar@itamarst.org> wrote:
I tried patching like that: from twisted.python.util import untilConcludes # I think you mean this, because twisted.internet.util does not exist self._realPortNumber = untilConcludes(lambda: skt.getsockname()[1]) but without luck. It seems to change nothing, it crashes at once with the same stack trace. I'm on Windows 7 64, Python 2.6.4, Twisted 8.2.0 I'm quite new to Python and very new to Twisted. I will look for "IOCP reactor" I'm going to file a bug on Trac, thank you for the help.

On Wed, 2009-11-18 at 06:03 -0800, Tommaso Mazzafico wrote:
1. Please file a bug at http://twistedmatrix.com/ - include version of Twisted, whether you have firewall of some sort, etc., so we can make sure this gets fixed. 2. Try patching the code so it does: from twisted.internet.util import untilConcludes self._realPortNumber = untilConcludes(lambda: skt.getsockname()[1]) Does this fix it? If it does, add this info to the bug. 3. Another thing to try is the IOCP reactor. -Itamar

--- On Wed, 11/18/09, Itamar Turner-Trauring (aka Shtull-Trauring) <itamar@itamarst.org> wrote:
I tried patching like that: from twisted.python.util import untilConcludes # I think you mean this, because twisted.internet.util does not exist self._realPortNumber = untilConcludes(lambda: skt.getsockname()[1]) but without luck. It seems to change nothing, it crashes at once with the same stack trace. I'm on Windows 7 64, Python 2.6.4, Twisted 8.2.0 I'm quite new to Python and very new to Twisted. I will look for "IOCP reactor" I'm going to file a bug on Trac, thank you for the help.
participants (2)
-
Itamar Turner-Trauring (aka Shtull-Trauring)
-
Tommaso Mazzafico