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
24dd8908
Commit
24dd8908
authored
Aug 31, 2013
by
Taddeüs Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
websocket class now inherits a larger list of attributes from socket.socket
parent
c2fd30a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
19 deletions
+11
-19
websocket.py
websocket.py
+11
-19
No files found.
websocket.py
View file @
24dd8908
...
...
@@ -6,6 +6,12 @@ from handshake import ServerHandshake, ClientHandshake
from
errors
import
SSLError
INHERITED_ATTRS
=
[
'bind'
,
'close'
,
'listen'
,
'fileno'
,
'getpeername'
,
'getsockname'
,
'getsockopt'
,
'setsockopt'
,
'setblocking'
,
'settimeout'
,
'gettimeout'
,
'shutdown'
,
'family'
,
'type'
,
'proto'
]
class
websocket
(
object
):
"""
Implementation of web socket, upgrades a regular TCP socket to a websocket
...
...
@@ -84,11 +90,12 @@ class websocket(object):
self
.
sock
=
sock
or
socket
.
socket
(
sfamily
,
socket
.
SOCK_STREAM
,
sproto
)
def
bind
(
self
,
address
):
self
.
sock
.
bind
(
address
)
def
__getattr__
(
self
,
name
):
if
name
in
INHERITED_ATTRS
:
return
getattr
(
self
.
sock
,
name
)
def
listen
(
self
,
backlog
):
self
.
sock
.
listen
(
backlog
)
raise
AttributeError
(
"'%s' has no attribute '%s'"
%
(
self
.
__class__
.
__name__
,
name
)
)
def
accept
(
self
):
"""
...
...
@@ -146,21 +153,6 @@ class websocket(object):
"""
return
[
self
.
recv
()
for
i
in
xrange
(
n
)]
def
getpeername
(
self
):
return
self
.
sock
.
getpeername
()
def
getsockname
(
self
):
return
self
.
sock
.
getsockname
()
def
setsockopt
(
self
,
level
,
optname
,
value
):
self
.
sock
.
setsockopt
(
level
,
optname
,
value
)
def
getsockopt
(
self
,
level
,
optname
):
return
self
.
sock
.
getsockopt
(
level
,
optname
)
def
close
(
self
):
self
.
sock
.
close
()
def
enable_ssl
(
self
,
*
args
,
**
kwargs
):
"""
Transforms the regular socket.socket to an ssl.SSLSocket for secure
...
...
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