Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wspy-monitor
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-monitor
Commits
30853e2d
Commit
30853e2d
authored
Dec 01, 2014
by
Taddeus Kroes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup
parent
75382d1a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
server.py
server.py
+7
-9
No files found.
server.py
View file @
30853e2d
...
...
@@ -5,9 +5,10 @@ import json
import
re
import
psutil
import
platform
import
sys
from
subprocess
import
check_output
from
threading
import
Thread
from
wspy
import
websocket
,
Frame
,
OPCODE_TEXT
,
WebkitDeflateFrame
from
wspy
import
websocket
,
Frame
,
OPCODE_TEXT
def
osname
():
...
...
@@ -20,7 +21,6 @@ def osname():
return
name
#return '%s %s' % (platform.system(), platform.release())
return
platform
.
platform
()
...
...
@@ -72,12 +72,11 @@ if __name__ == '__main__':
try
:
client
.
send
(
status
)
except
socket
.
error
:
print
'Client disconnected'
print
>>
sys
.
stderr
,
'Client disconnected'
clients
.
remove
(
client
)
time
.
sleep
(
1
)
#server = websocket(extensions=[WebkitDeflateFrame()])
server
=
websocket
()
server
.
setsockopt
(
socket
.
SOL_SOCKET
,
socket
.
SO_REUSEADDR
,
1
)
server
.
bind
((
''
,
8100
))
...
...
@@ -90,12 +89,10 @@ if __name__ == '__main__':
while
True
:
try
:
sock
,
address
=
server
.
accept
()
except
KeyboardInterrupt
:
raise
except
:
except
socket
.
error
:
continue
print
'Client connected at %s:%d'
%
address
print
>>
sys
.
stderr
,
'Client connected at %s:%d'
%
address
clients
.
append
(
sock
)
if
not
t
.
is_alive
():
...
...
@@ -103,5 +100,6 @@ if __name__ == '__main__':
t
.
daemon
=
True
t
.
start
()
except
KeyboardInterrupt
:
print
'Stopping server'
print
>>
sys
.
stderr
,
'Stopping server'
finally
:
server
.
close
()
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