2020-10-24 17:56:18 +00:00
|
|
|
import socket
|
|
|
|
|
|
|
|
HOST, PORT = "localhost", 42424
|
|
|
|
|
2020-11-09 21:32:27 +00:00
|
|
|
robot_id = 11
|
2020-10-24 17:56:18 +00:00
|
|
|
|
|
|
|
# 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))
|