import socket

HOST, PORT = "localhost", 42424

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:
    received = str(sock.recv(1024), "utf-8")
    print("Received: {}".format(received))
    receiving = len(received) > 0
