diff --git a/bindings.py b/bindings.py index 2fcea82..ac354c5 100755 --- a/bindings.py +++ b/bindings.py @@ -656,6 +656,7 @@ class analogController(object): except OSError as e: eprint(e) eprint('The socket connection is experiencing issues') + sys.exit() def socketLoop(self): @@ -688,7 +689,7 @@ class analogController(object): try: iprint(">>> Sending direct: {}".format(direct)) self.sck.sendall(direct) - except: + except socket.error: eprint("Error sending data: ",direct) def sendData(self,data): diff --git a/falseserver.py b/falseserver.py index 57f73ae..29e9e4e 100644 --- a/falseserver.py +++ b/falseserver.py @@ -24,8 +24,8 @@ class Answer(object): def __radd__(self,other): if type(other)==str: def new_funct(match): - return other+self.function - return new_funct + return other+self.function(match) + return Answer(new_funct) else: raise TypeError @@ -46,6 +46,7 @@ _goodanswers={ "#":_MSG+_0, "PRinp":_MSG+_ARG, "PUscu":_MSG+_ARG, + ",GCtav":"GCtav"+_ARG+Answer(",1"), "_":_MSG+_ARG, } def goodServer(s,addr,delay=_DELAY): @@ -85,6 +86,9 @@ def Main(delay=_DELAY): # print(c.recv(4000)) # c.sendall(b"*\r\n") start_new_thread(goodServer, (c,addr,delay,)) + cont=input("Keep accepting connections ?") + if cont.lower()=="n": + break s.close()