From 5fb3ea060025241105dc8e9a174513c112f9a133 Mon Sep 17 00:00:00 2001 From: rcoh Date: Thu, 27 Jan 2011 16:50:59 -0500 Subject: A metric $#%$-ton of changes. Added doc-strings to EVERYTHING. Phew. Fixed a massive bug that increases performance in by up to a factor of 60. A bunch of new behaviors for the class. --- inputs/TCPInput.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'inputs/TCPInput.py') diff --git a/inputs/TCPInput.py b/inputs/TCPInput.py index 2bc69ef..17ea7e6 100644 --- a/inputs/TCPInput.py +++ b/inputs/TCPInput.py @@ -6,6 +6,10 @@ import logging as main_log import string class TCPInput(Input): + """TCPInput is a input to receive input on a TCP port. In its current incarnation, it parses + json data into python dicts. Warning: contains a bug where init will hang until it receives a + connection. Specify: + -- Port number to listen on.""" def inputInit(self): self.HOST = '' # Symbolic name meaning all available interfaces self.PORT = self.argDict['Port'] # Arbitrary non-privileged port @@ -34,12 +38,7 @@ class TCPInput(Input): for datagroup in data.split('\n'): if datagroup != None and datagroup != '': dataDict = json.loads(datagroup) - #print dataDict self.respond(dataDict) - #socketDict = {'data':dataDict, 'address':self.address} - #socketDict = {Strings.LOCATION: (dataDict['x'], dataDict['y'])} # like PygameInput - #print 'input' - #self.respond(socketDict) except Exception as exp: print str(exp) else: -- cgit v1.2.3