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
Hide 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
...
@@ -5,9 +5,10 @@ import json
import
re
import
re
import
psutil
import
psutil
import
platform
import
platform
import
sys
from
subprocess
import
check_output
from
subprocess
import
check_output
from
threading
import
Thread
from
threading
import
Thread
from
wspy
import
websocket
,
Frame
,
OPCODE_TEXT
,
WebkitDeflateFrame
from
wspy
import
websocket
,
Frame
,
OPCODE_TEXT
def
osname
():
def
osname
():
...
@@ -20,7 +21,6 @@ def osname():
...
@@ -20,7 +21,6 @@ def osname():
return
name
return
name
#return '%s %s' % (platform.system(), platform.release())
return
platform
.
platform
()
return
platform
.
platform
()
...
@@ -72,12 +72,11 @@ if __name__ == '__main__':
...
@@ -72,12 +72,11 @@ if __name__ == '__main__':
try
:
try
:
client
.
send
(
status
)
client
.
send
(
status
)
except
socket
.
error
:
except
socket
.
error
:
print
'Client disconnected'
print
>>
sys
.
stderr
,
'Client disconnected'
clients
.
remove
(
client
)
clients
.
remove
(
client
)
time
.
sleep
(
1
)
time
.
sleep
(
1
)
#server = websocket(extensions=[WebkitDeflateFrame()])
server
=
websocket
()
server
=
websocket
()
server
.
setsockopt
(
socket
.
SOL_SOCKET
,
socket
.
SO_REUSEADDR
,
1
)
server
.
setsockopt
(
socket
.
SOL_SOCKET
,
socket
.
SO_REUSEADDR
,
1
)
server
.
bind
((
''
,
8100
))
server
.
bind
((
''
,
8100
))
...
@@ -90,12 +89,10 @@ if __name__ == '__main__':
...
@@ -90,12 +89,10 @@ if __name__ == '__main__':
while
True
:
while
True
:
try
:
try
:
sock
,
address
=
server
.
accept
()
sock
,
address
=
server
.
accept
()
except
KeyboardInterrupt
:
except
socket
.
error
:
raise
except
:
continue
continue
print
'Client connected at %s:%d'
%
address
print
>>
sys
.
stderr
,
'Client connected at %s:%d'
%
address
clients
.
append
(
sock
)
clients
.
append
(
sock
)
if
not
t
.
is_alive
():
if
not
t
.
is_alive
():
...
@@ -103,5 +100,6 @@ if __name__ == '__main__':
...
@@ -103,5 +100,6 @@ if __name__ == '__main__':
t
.
daemon
=
True
t
.
daemon
=
True
t
.
start
()
t
.
start
()
except
KeyboardInterrupt
:
except
KeyboardInterrupt
:
print
'Stopping server'
print
>>
sys
.
stderr
,
'Stopping server'
finally
:
server
.
close
()
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