mehr kram

This commit is contained in:
End 2020-08-21 20:40:37 +02:00
parent 70ec94fa76
commit 6a650ef1e8
6 changed files with 89 additions and 96 deletions

View file

@ -60,14 +60,16 @@ class NetworkThread(threading.Thread):
def send_msg_and_ack(self, msg):
while True:
print("m sending")
a = convert_to_strings(msg)
self.socket.send(str.encode(json.dumps(a)))
if (self.socket.poll(5) & zmq.POLLIN) != 0:
if (self.socket.poll(50) & zmq.POLLIN) != 0:
msg = self.socket.recv()
try:
if msg:
result = json.loads(msg)
if result["msg"] == "ack":
print("m ack received")
return result
else:
print("got unexpected message {result}")