Windows 7: A non-blocking socket operation could not be completed immediately

[email protected] Wed, 18 Nov 2009 21:06:28 -0000
Newsgroups gmane.comp.python.twisted.bugs
Message-ID <[email protected]>
New submission from tom <None>:

Windows 7: A non-blocking socket operation could not be completed immediately

I'm on Windows 7 64, Python 2.6.4, Twisted 8.2.0
{{{
from twisted.internet import reactor, protocol
class Echo(protocol.Protocol):
   def dataReceived(self, data):
      self.transport.write(data)
reactor.listenTCP(8000, Echo())
reactor.run()
}}}

It crashes at once with the following message:
{{{
Traceback (most recent call last):
  File "C:\Users\tom\Documents\server.py", line 5, in <module>
    reactor.listenTCP(8000, Echo())
  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
}}}

tried this patch, but nothing changes:
{{{
from twisted.python.util import untilConcludes
self._realPortNumber = untilConcludes(lambda: skt.getsockname()[1])
}}}

----------
Type     : defect
Component: core
Keywords : windows
Priority : high
Nosy     : 
----------
http://twistedmatrix.com/trac/ticket/4119