summaryrefslogtreecommitdiffstats
path: root/god/Reaktor
diff options
context:
space:
mode:
authortv <tv@xso>2011-08-31 23:49:52 +0200
committertv <tv@xso>2011-08-31 23:49:52 +0200
commit40474badc13adff28f34424b860500c45871f781 (patch)
treed607ed10d1f00638355d33d61cea4e98db1ff754 /god/Reaktor
parent9030631edd4f5e44234fe77348b92190874f42a2 (diff)
//god/Reaktor: initial commit
Diffstat (limited to 'god/Reaktor')
-rwxr-xr-xgod/Reaktor22
1 files changed, 22 insertions, 0 deletions
diff --git a/god/Reaktor b/god/Reaktor
new file mode 100755
index 00000000..54bc5099
--- /dev/null
+++ b/god/Reaktor
@@ -0,0 +1,22 @@
+#! /usr/bin/env python
+
+import socket
+from struct import unpack
+
+listen_address = '0.0.0.0'
+listen_port = 2342
+
+# create udp socket
+mysocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+
+# allow send/recieve from broacast address
+mysocket.setsockopt(socket.SOL_SOCKET,socket.SO_BROADCAST,1)
+
+# allow the socket to be re-used
+mysocket.setsockopt(socket.SOL_SOCKET,socket.SO_REUSEADDR,1)
+mysocket.bind((listen_address, listen_port))
+
+while True:
+ dev, state = unpack('BB', mysocket.recv(2))
+ print "dev: " + str(dev)
+ print "state: " + str(state)