Commit dc39cee4 authored by Jason Madden's avatar Jason Madden

echoserver.py binds to a different port to avoid interference with X11. Fixes #485.

parent 5e7bc8d3
...@@ -40,6 +40,8 @@ Unreleased ...@@ -40,6 +40,8 @@ Unreleased
Python 3 counterpart. Python 3 counterpart.
- An exception starting a child process with the ``gevent.subprocess`` - An exception starting a child process with the ``gevent.subprocess``
module no longer leaks file descriptors. Reported in :pr:`374` by 陈小玉. module no longer leaks file descriptors. Reported in :pr:`374` by 陈小玉.
- The example ``echoserver.py`` no longer binds to the standard X11
TCP port. Reported in :issue:`485` by minusf.
1.1a1 (Jun 29, 2015) 1.1a1 (Jun 29, 2015)
==================== ====================
......
#!/usr/bin/env python #!/usr/bin/env python
"""Simple server that listens on port 6000 and echos back every input to the client. """Simple server that listens on port 16000 and echos back every input to the client.
Connect to it with: Connect to it with:
telnet localhost 6000 telnet localhost 16000
Terminate the connection by terminating telnet (typically Ctrl-] and then 'quit'). Terminate the connection by terminating telnet (typically Ctrl-] and then 'quit').
""" """
...@@ -30,8 +30,8 @@ def echo(socket, address): ...@@ -30,8 +30,8 @@ def echo(socket, address):
if __name__ == '__main__': if __name__ == '__main__':
# to make the server use SSL, pass certfile and keyfile arguments to the constructor # to make the server use SSL, pass certfile and keyfile arguments to the constructor
server = StreamServer(('0.0.0.0', 6000), echo) server = StreamServer(('0.0.0.0', 16000), echo)
# to start the server asynchronously, use its start() method; # to start the server asynchronously, use its start() method;
# we use blocking serve_forever() here because we have no other jobs # we use blocking serve_forever() here because we have no other jobs
print('Starting echo server on port 6000') print('Starting echo server on port 16000')
server.serve_forever() server.serve_forever()
...@@ -16,7 +16,7 @@ class Test(util.TestServer): ...@@ -16,7 +16,7 @@ class Test(util.TestServer):
else: else:
kwargs = {'bufsize': 1} kwargs = {'bufsize': 1}
kwargs['mode'] = 'rb' kwargs['mode'] = 'rb'
conn = create_connection(('127.0.0.1', 6000)) conn = create_connection(('127.0.0.1', 16000))
conn.settimeout(0.1) conn.settimeout(0.1)
rfile = conn.makefile(**kwargs) rfile = conn.makefile(**kwargs)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment