summaryrefslogtreecommitdiffstats
path: root/Code
diff options
context:
space:
mode:
authorgsmselftest2011-11-09 19:08:11 +0100
committergsmselftest2011-11-09 19:08:11 +0100
commit52824d5bc8051acc49134c98f376f2ebf83a7b58 (patch)
treeb107b05581a95f4a31c719a99816820835c628c9 /Code
parentReplaced report with the new file (diff)
downloadgsm-selftest-52824d5bc8051acc49134c98f376f2ebf83a7b58.tar.gz
gsm-selftest-52824d5bc8051acc49134c98f376f2ebf83a7b58.tar.xz
gsm-selftest-52824d5bc8051acc49134c98f376f2ebf83a7b58.zip
add README text
Diffstat (limited to 'Code')
-rw-r--r--Code/Box1-Code/READ ME.txt3
-rw-r--r--Code/Box1-Code/ServerClass.py12
-rw-r--r--Code/Box2-Code/READ ME.txt4
-rw-r--r--Code/Box2-Code/ServerClass.py12
4 files changed, 29 insertions, 2 deletions
diff --git a/Code/Box1-Code/READ ME.txt b/Code/Box1-Code/READ ME.txt
index d5db13f..65be275 100644
--- a/Code/Box1-Code/READ ME.txt
+++ b/Code/Box1-Code/READ ME.txt
@@ -14,3 +14,6 @@ Handler files:
- serverHandler.py
+How to start the server Handler:
+ - you can use SSH connection to the box and type:
+ - $ sudo python serverHandler.py $
diff --git a/Code/Box1-Code/ServerClass.py b/Code/Box1-Code/ServerClass.py
index 8687629..088a2ae 100644
--- a/Code/Box1-Code/ServerClass.py
+++ b/Code/Box1-Code/ServerClass.py
@@ -3,6 +3,8 @@ import sys
import os
import string
import signal
+import fcntl
+import struct
class TimeoutException(Exception):
pass
@@ -11,7 +13,15 @@ class ServerHandler:
def __init__(self,p):
self.port = p
- self.host = None #symbolic name meaning all available interfaces
+ ifname = 'eth0' #define here the interface you want to find the ip address
+
+ #code for getting our public addresss so I can make the SSH tunneling work
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ publicAddress = socket.inet_ntoa(fcntl.ioctl(
+ s.fileno(),0x8915, # SIOCGIFADDR
+ struct.pack('256s', ifname[:15]))[20:24])
+
+ self.host = publicAddress #None #'127.0.0.1' #symbolic name meaning all available interfaces
self.s = None
self.connected = 0
self.address = "127.0.0.1" #address of the main controller
diff --git a/Code/Box2-Code/READ ME.txt b/Code/Box2-Code/READ ME.txt
index d5db13f..654b1f2 100644
--- a/Code/Box2-Code/READ ME.txt
+++ b/Code/Box2-Code/READ ME.txt
@@ -14,3 +14,7 @@ Handler files:
- serverHandler.py
+How to start the server Handler:
+ - you can use SSH connection to the box and type:
+ - $ sudo python serverHandler.py $
+
diff --git a/Code/Box2-Code/ServerClass.py b/Code/Box2-Code/ServerClass.py
index 8687629..088a2ae 100644
--- a/Code/Box2-Code/ServerClass.py
+++ b/Code/Box2-Code/ServerClass.py
@@ -3,6 +3,8 @@ import sys
import os
import string
import signal
+import fcntl
+import struct
class TimeoutException(Exception):
pass
@@ -11,7 +13,15 @@ class ServerHandler:
def __init__(self,p):
self.port = p
- self.host = None #symbolic name meaning all available interfaces
+ ifname = 'eth0' #define here the interface you want to find the ip address
+
+ #code for getting our public addresss so I can make the SSH tunneling work
+ s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ publicAddress = socket.inet_ntoa(fcntl.ioctl(
+ s.fileno(),0x8915, # SIOCGIFADDR
+ struct.pack('256s', ifname[:15]))[20:24])
+
+ self.host = publicAddress #None #'127.0.0.1' #symbolic name meaning all available interfaces
self.s = None
self.connected = 0
self.address = "127.0.0.1" #address of the main controller