Permalink
Browse files

Adding python client.

  • Loading branch information...
spoletto committed Apr 23, 2012
1 parent 91aae38 commit 307c4eaeafb50e10ac763227472b0e5949728e95
Showing with 7 additions and 2 deletions.
  1. +7 −2 client/ws-server.py
View
@@ -13,6 +13,8 @@
subprocess.check_call('sudo route delete default', shell=True)
subprocess.check_call('sudo route add default 10.0.0.1', shell=True)
connection = None
class TunReader(threading.Thread):
def __init__(self, server):
self.server = server
@@ -24,11 +26,13 @@ def run(self):
dataFromTun = tun.read()
#dataFromTun = dataFromTun.decode('bin')
print "message received from tunnel: " + dataFromTun
self.server.write_message(dataFromTun)
if connection:
connection.write_message(dataFromTun)
class Handler(WebSocketHandler):
def open(self):
print "New connection opened."
connection = self
def on_message(self, message):
print "raw message: " + message
@@ -37,7 +41,8 @@ def on_message(self, message):
tun.write(m)
def on_close(self):
print "Connection closed."
print "Connection closed."
connection = None
def allow_draft76(self):
return True

0 comments on commit 307c4ea

Please sign in to comment.