2020-10-24 17:56:18 +00:00
|
|
|
import socket
|
|
|
|
|
|
|
|
HOST, PORT = "localhost", 42424
|
|
|
|
|
|
|
|
robot_id = 15
|
|
|
|
|
|
|
|
# SOCK_DGRAM is the socket type to use for UDP sockets
|
|
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
|
|
|
|
|
|
|
sock.sendto(f"{robot_id}\n".encode(), (HOST, PORT))
|
|
|
|
while True:
|
|
|
|
received = str(sock.recv(1024), "utf-8")
|
2020-10-24 19:16:17 +00:00
|
|
|
print("Received: {}".format(received))
|