Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples/ping-pong.py: getting IOError when using 'real' sockets instead of Fake streams #4

Open
thekorn opened this issue Mar 16, 2011 · 0 comments

Comments

@thekorn
Copy link

thekorn commented Mar 16, 2011

I'm trying to find out how python-xmpp-server works by looking at the examples.
ping-pong.py works fine, as long as I use the Fake stream, but when I comment these three lines, and uncomment the xmpp.{TCPServer,TCPClient} lines I get an IOError:

diff --git a/examples/ping-pong.py b/examples/ping-pong.py
index 75f9f6f..c5100d5 100644
--- a/examples/ping-pong.py
+++ b/examples/ping-pong.py
@@ -154,11 +154,11 @@ if __name__ == '__main__':
         'keyfile': os.path.join(os.path.dirname(__file__), 'certs/self.key')
     })

-    CP = Stream('C', client, lambda d: SP.reader(d))
-    SP = Stream('S', server, lambda d: CP.reader(d))
-    Stream.loop()
+    #~ CP = Stream('C', client, lambda d: SP.reader(d))
+    #~ SP = Stream('S', server, lambda d: CP.reader(d))
+    #~ Stream.loop()

-    # SP = xmpp.TCPServer(server).bind('127.0.0.1', '9000')
-    # CP = xmpp.TCPClient(client).connect('127.0.0.1', '9000')
-    # xmpp.start([SP, CP])
+    SP = xmpp.TCPServer(server).bind('127.0.0.1', '9000')
+    CP = xmpp.TCPClient(client).connect('127.0.0.1', '9000')
+    xmpp.start([SP, CP])

% python examples/ping-pong.py
ERROR:root:TCPClient: error while handling WRITE
Traceback (most recent call last):
  File "/home/markus/.local/lib/python2.7/site-packages/xmpp/aio.py", line 148, in _ready
    self.handler(self.socket, self.address, self.io)
  File "/home/markus/.local/lib/python2.7/site-packages/xmpp/xmppstream.py", line 60, in __call__
    stream = readstream.ReadStream(socket, io_loop, **kwargs)
  File "/home/markus/.local/lib/python2.7/site-packages/xmpp/readstream.py", line 28, in __init__
    self.io.add_handler(socket.fileno(), self._handle, self._state)
  File "/usr/lib/pymodules/python2.7/tornado/ioloop.py", line 149, in add_handler
    self._impl.register(fd, events | self.ERROR)
IOError: [Errno 17] File exists

% python --version
Python 2.7.1+
(package on ubuntu 11.04)

Tell me if I can provide further information.
Thanks in advance,
Markus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant