Updated runtime files.

This commit is contained in:
Bram Moolenaar
2016-03-20 21:08:34 +01:00
parent be6aa46c4d
commit e18c0b3981
17 changed files with 143 additions and 127 deletions

View File

@ -50,7 +50,7 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
if data == '':
print("=== socket closed ===")
break
print("received: {}".format(data))
print("received: {0}".format(data))
try:
decoded = json.loads(data)
except ValueError:
@ -65,7 +65,7 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler):
else:
response = "what?"
encoded = json.dumps([decoded[0], response])
print("sending {}".format(encoded))
print("sending {0}".format(encoded))
self.request.sendall(encoded.encode('utf-8'))
thesocket = None
@ -87,7 +87,7 @@ if __name__ == "__main__":
server_thread.start()
print("Server loop running in thread: ", server_thread.name)
print("Listening on port {}".format(PORT))
print("Listening on port {0}".format(PORT))
while True:
typed = sys.stdin.readline()
if "quit" in typed:
@ -96,7 +96,7 @@ if __name__ == "__main__":
if thesocket is None:
print("No socket yet")
else:
print("sending {}".format(typed))
print("sending {0}".format(typed))
thesocket.sendall(typed.encode('utf-8'))
server.shutdown()