diff options
Diffstat (limited to 'inputs/UDPInput.py')
-rw-r--r-- | inputs/UDPInput.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/inputs/UDPInput.py b/inputs/UDPInput.py new file mode 100644 index 0000000..b0d6c93 --- /dev/null +++ b/inputs/UDPInput.py @@ -0,0 +1,17 @@ +import Util +from operationscore.Input import * +import socket +class UDPInput(Input): + def inputInit(self): + HOST = '' # Symbolic name meaning all available interfaces + PORT = self.argDict['Port'] # Arbitrary non-privileged port + self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + self.sock.bind((HOST, PORT)) + print 'UDPINIT' + def sensingLoop(self): + print 'udploop' + (data,address) = self.sock.recvfrom(1024) + dataDict = {'data':data, 'address':address} + print 'LOLOLOLOL' + self.respond(dataDict) + |