tweaking the fakeserver
This commit is contained in:
parent
c847c7fd88
commit
3ae407afc9
|
|
@ -656,6 +656,7 @@ class analogController(object):
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
eprint(e)
|
eprint(e)
|
||||||
eprint('The socket connection is experiencing issues')
|
eprint('The socket connection is experiencing issues')
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
|
||||||
def socketLoop(self):
|
def socketLoop(self):
|
||||||
|
|
@ -688,7 +689,7 @@ class analogController(object):
|
||||||
try:
|
try:
|
||||||
iprint(">>> Sending direct: {}".format(direct))
|
iprint(">>> Sending direct: {}".format(direct))
|
||||||
self.sck.sendall(direct)
|
self.sck.sendall(direct)
|
||||||
except:
|
except socket.error:
|
||||||
eprint("Error sending data: ",direct)
|
eprint("Error sending data: ",direct)
|
||||||
|
|
||||||
def sendData(self,data):
|
def sendData(self,data):
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,8 @@ class Answer(object):
|
||||||
def __radd__(self,other):
|
def __radd__(self,other):
|
||||||
if type(other)==str:
|
if type(other)==str:
|
||||||
def new_funct(match):
|
def new_funct(match):
|
||||||
return other+self.function
|
return other+self.function(match)
|
||||||
return new_funct
|
return Answer(new_funct)
|
||||||
else:
|
else:
|
||||||
raise TypeError
|
raise TypeError
|
||||||
|
|
||||||
|
|
@ -46,6 +46,7 @@ _goodanswers={
|
||||||
"#":_MSG+_0,
|
"#":_MSG+_0,
|
||||||
"PRinp":_MSG+_ARG,
|
"PRinp":_MSG+_ARG,
|
||||||
"PUscu":_MSG+_ARG,
|
"PUscu":_MSG+_ARG,
|
||||||
|
",GCtav":"GCtav"+_ARG+Answer(",1"),
|
||||||
"_":_MSG+_ARG,
|
"_":_MSG+_ARG,
|
||||||
}
|
}
|
||||||
def goodServer(s,addr,delay=_DELAY):
|
def goodServer(s,addr,delay=_DELAY):
|
||||||
|
|
@ -85,6 +86,9 @@ def Main(delay=_DELAY):
|
||||||
# print(c.recv(4000))
|
# print(c.recv(4000))
|
||||||
# c.sendall(b"*\r\n")
|
# c.sendall(b"*\r\n")
|
||||||
start_new_thread(goodServer, (c,addr,delay,))
|
start_new_thread(goodServer, (c,addr,delay,))
|
||||||
|
cont=input("Keep accepting connections ?")
|
||||||
|
if cont.lower()=="n":
|
||||||
|
break
|
||||||
s.close()
|
s.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue