diff options
author | rcoh <rcoh@mit.edu> | 2011-02-01 23:14:12 -0500 |
---|---|---|
committer | rcoh <rcoh@mit.edu> | 2011-02-01 23:14:12 -0500 |
commit | 5a97e7548b0ec44f0d61a724903748197e69df7c (patch) | |
tree | 7bb6b8ea7e488949eeb16ae18b0ad2230f1f7c9b /inputs/UDPInput.py | |
parent | 082e4b0c53123dd377da148541f7d98516716862 (diff) | |
parent | 482a94fd48627153b923931d6ff21ebf57fad6f7 (diff) |
Merge branch 'osc' of github.com:rcoh/SmootLight into osc
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) |