summaryrefslogtreecommitdiffstats
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
commit09d6dd479e62372badb4684c5718038f72198295 (patch)
treee38806f08adfe83d16a0ba051d11c296e86d392b
parentcf46dbc53b36772fb0461b9451337c118e705c55 (diff)
//god/Reaktor: initial commit
-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)