Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
misc
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
misc
Commits
f9aa2e26
Commit
f9aa2e26
authored
Apr 27, 2016
by
Yury Selivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Twisted
parent
bc0f5d44
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
run_benchmarks
run_benchmarks
+6
-0
servers/twistedecho.py
servers/twistedecho.py
+25
-0
No files found.
run_benchmarks
View file @
f9aa2e26
...
...
@@ -49,6 +49,12 @@ benchmarks = [{
'server'
:
python
+
[
'/usr/src/servers/torecho.py'
],
'server_address'
:
tcp_address
,
'client'
:
tcp_client
,
},
{
'name'
:
'tcpecho-twisted'
,
'title'
:
'TCP echo server (twisted)'
,
'server'
:
python
+
[
'/usr/src/servers/twistedecho.py'
],
'server_address'
:
tcp_address
,
'client'
:
tcp_client
,
},
{
'name'
:
'tcpecho-curio-socket'
,
'title'
:
'TCP echo server (curio/socket)'
,
...
...
servers/twistedecho.py
0 → 100644
View file @
f9aa2e26
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from
twisted.internet
import
reactor
,
protocol
class
Echo
(
protocol
.
Protocol
):
"""This is just about the simplest possible protocol"""
def
dataReceived
(
self
,
data
):
"As soon as any data is received, write it back."
self
.
transport
.
write
(
data
)
def
main
():
"""This runs the protocol on port 25000"""
factory
=
protocol
.
ServerFactory
()
factory
.
protocol
=
Echo
reactor
.
listenTCP
(
25000
,
factory
)
reactor
.
run
()
# this only runs if the module was *not* imported
if
__name__
==
'__main__'
:
main
()
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