forked from Telos4/RoboRally
13 lines
326 B
Python
13 lines
326 B
Python
|
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")
|
||
|
print("Received: {}".format(received))
|