Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
dc39cee4
Commit
dc39cee4
authored
Jul 07, 2015
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
echoserver.py binds to a different port to avoid interference with X11. Fixes #485.
parent
5e7bc8d3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
changelog.rst
changelog.rst
+2
-0
examples/echoserver.py
examples/echoserver.py
+4
-4
greentest/test__example_echoserver.py
greentest/test__example_echoserver.py
+1
-1
No files found.
changelog.rst
View file @
dc39cee4
...
...
@@ -40,6 +40,8 @@ Unreleased
Python 3 counterpart.
- An exception starting a child process with the ``gevent.subprocess``
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)
====================
...
...
examples/echoserver.py
View file @
dc39cee4
#!/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
1
6000 and echos back every input to the client.
Connect to it with:
telnet localhost 6000
telnet localhost
1
6000
Terminate the connection by terminating telnet (typically Ctrl-] and then 'quit').
"""
...
...
@@ -30,8 +30,8 @@ def echo(socket, address):
if
__name__
==
'__main__'
:
# 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'
,
1
6000
),
echo
)
# to start the server asynchronously, use its start() method;
# 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
1
6000'
)
server
.
serve_forever
()
greentest/test__example_echoserver.py
View file @
dc39cee4
...
...
@@ -16,7 +16,7 @@ class Test(util.TestServer):
else
:
kwargs
=
{
'bufsize'
:
1
}
kwargs
[
'mode'
]
=
'rb'
conn
=
create_connection
((
'127.0.0.1'
,
6000
))
conn
=
create_connection
((
'127.0.0.1'
,
1
6000
))
conn
.
settimeout
(
0.1
)
rfile
=
conn
.
makefile
(
**
kwargs
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment