diff options
Diffstat (limited to 'inputs/UDPInput.py')
-rw-r--r-- | inputs/UDPInput.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/inputs/UDPInput.py b/inputs/UDPInput.py index 7d5609e..83e2f77 100644 --- a/inputs/UDPInput.py +++ b/inputs/UDPInput.py @@ -1,13 +1,17 @@ from operationscore.Input import * import socket class UDPInput(Input): + """UDPInput is a barebones UDP Input class. It takes any data it receives and adds it to the + 'data' element of the response dict. It also notes the 'address'. Specify: + <Port> -- the Port to listen on.""" + 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)) def sensingLoop(self): - (data,address) = self.sock.recvfrom(1024) - dataDict = {'data':data, 'address':address} - self.respond(dataDict) + (data,address) = self.sock.recvfrom(1024) + dataDict = {'data':data, 'address':address} + self.respond(dataDict) |