Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wspy
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Taddeüs Kroes
wspy
Commits
6548f5d9
Commit
6548f5d9
authored
Nov 03, 2013
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test client that talks to a server using stdin
parent
a55b2fad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
0 deletions
+41
-0
test/talk.py
test/talk.py
+41
-0
No files found.
test/talk.py
0 → 100755
View file @
6548f5d9
#!/usr/bin/env python
import
sys
import
socket
from
websocket
import
websocket
from
connection
import
Connection
from
message
import
TextMessage
from
errors
import
SocketClosed
if
__name__
==
'__main__'
:
if
len
(
sys
.
argv
)
<
3
:
print
>>
sys
.
stderr
,
'Usage: python %s HOST PORT'
%
sys
.
argv
[
0
]
sys
.
exit
(
1
)
host
=
sys
.
argv
[
1
]
port
=
int
(
sys
.
argv
[
2
])
sock
=
websocket
()
sock
.
connect
((
host
,
port
))
sock
.
settimeout
(
1.0
)
conn
=
Connection
(
sock
)
try
:
try
:
while
True
:
msg
=
TextMessage
(
raw_input
())
print
'send: %s'
,
msg
conn
.
send
(
msg
)
try
:
print
'recv: %s'
%
conn
.
recv
()
except
socket
.
timeout
:
print
'no response'
except
EOFError
:
conn
.
close
()
except
SocketClosed
as
e
:
if
e
.
initialized
:
print
'closed connection'
else
:
print
'other side closed connection'
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