aboutsummaryrefslogtreecommitdiff
path: root/inputs/UDPInput.py
diff options
context:
space:
mode:
authorGravatar Russell Cohen <rcoh@mit.edu>2010-11-24 01:09:12 -0500
committerGravatar Russell Cohen <rcoh@mit.edu>2010-11-24 01:09:12 -0500
commitb042647b68abdc82490ca6e059993b8eba28904c (patch)
treea9ee95a38e98b377c251b7b2e9af9cbd8056cf7c /inputs/UDPInput.py
parent407ac922fc4178021cf3a16dfb1bd875b6083ac4 (diff)
Refactoring complete! Made modules/packages as appropriate. Finally.
Diffstat (limited to 'inputs/UDPInput.py')
-rw-r--r--inputs/UDPInput.py17
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)
+