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
9e651ded
Commit
9e651ded
authored
May 21, 2016
by
Yury Selivanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update curio
parent
3728d87c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
16 deletions
+14
-16
servers/curioecho.py
servers/curioecho.py
+3
-4
servers/curioecho_streams.py
servers/curioecho_streams.py
+10
-11
servers/requirements.txt
servers/requirements.txt
+1
-1
No files found.
servers/curioecho.py
View file @
9e651ded
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# A simple echo server
# A simple echo server
from
curio
import
Kernel
,
new_task
,
run
_server
from
curio
import
run
,
tcp
_server
from
socket
import
*
from
socket
import
*
...
@@ -14,12 +14,11 @@ async def echo_handler(client, addr):
...
@@ -14,12 +14,11 @@ async def echo_handler(client, addr):
pass
pass
while
True
:
while
True
:
data
=
await
client
.
recv
(
10
24
00
)
data
=
await
client
.
recv
(
10
000
00
)
if
not
data
:
if
not
data
:
break
break
await
client
.
sendall
(
data
)
await
client
.
sendall
(
data
)
print
(
'Connection closed'
)
print
(
'Connection closed'
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
kernel
=
Kernel
()
run
(
tcp_server
(
''
,
25000
,
echo_handler
))
kernel
.
run
(
run_server
(
''
,
25000
,
echo_handler
))
servers/curioecho_streams.py
View file @
9e651ded
from
curio
import
Kernel
,
new_task
,
run
_server
from
curio
import
run
,
spawn
,
tcp
_server
from
socket
import
*
from
socket
import
*
async
def
echo_handler
(
client
,
addr
):
async
def
echo_handler
(
client
,
addr
):
...
@@ -7,16 +7,15 @@ async def echo_handler(client, addr):
...
@@ -7,16 +7,15 @@ async def echo_handler(client, addr):
client
.
setsockopt
(
IPPROTO_TCP
,
TCP_NODELAY
,
1
)
client
.
setsockopt
(
IPPROTO_TCP
,
TCP_NODELAY
,
1
)
except
(
OSError
,
NameError
):
except
(
OSError
,
NameError
):
pass
pass
reader
,
writer
=
client
.
make_streams
()
s
=
client
.
as_stream
()
async
with
reader
,
writer
:
while
True
:
while
True
:
data
=
await
s
.
read
(
102400
)
data
=
await
reader
.
read
(
102400
)
if
not
data
:
if
not
data
:
break
break
await
s
.
write
(
data
)
await
writer
.
write
(
data
)
await
s
.
close
()
await
client
.
close
()
print
(
'Connection closed'
)
print
(
'Connection closed'
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
kernel
=
Kernel
()
run
(
tcp_server
(
''
,
25000
,
echo_handler
))
kernel
.
run
(
run_server
(
''
,
25000
,
echo_handler
))
servers/requirements.txt
View file @
9e651ded
curio==0.
1
curio==0.
4
aiohttp==0.21.5
aiohttp==0.21.5
gevent==1.1.1
gevent==1.1.1
tornado==4.3
tornado==4.3
...
...
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