2020-10-24 17:56:18 +00:00
|
|
|
import socket
|
|
|
|
|
|
|
|
HOST, PORT = "localhost", 42424
|
|
|
|
|
2020-11-11 20:33:48 +00:00
|
|
|
robot_id = 12
|
|
|
|
|
|
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
|
|
sock.connect((HOST, PORT))
|
|
|
|
sock.sendall(f"{robot_id}\n".encode()) # request data for robot with given id
|
|
|
|
#sock.sendall(f"events\n".encode()) # request events
|
|
|
|
receiving = True
|
|
|
|
while receiving:
|
2020-10-24 17:56:18 +00:00
|
|
|
received = str(sock.recv(1024), "utf-8")
|
2020-10-24 19:16:17 +00:00
|
|
|
print("Received: {}".format(received))
|
2020-11-11 20:33:48 +00:00
|
|
|
receiving = len(received) > 0
|