From 40474badc13adff28f34424b860500c45871f781 Mon Sep 17 00:00:00 2001 From: tv Date: Wed, 31 Aug 2011 23:49:52 +0200 Subject: //god/Reaktor: initial commit --- god/Reaktor | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 god/Reaktor 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) -- cgit v1.2.3