import socket import time i = 1 UDP_IP = "127.0.0.1" UDP_PORT = 5001 MESSAGE = "{}".format(i) print("UDP target IP: %s" % UDP_IP) print("UDP target port: %s" % UDP_PORT) sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # create UDP socket while True: sock.sendto(bytes(MESSAGE, "utf-8"), (UDP_IP, UDP_PORT)) i += 1 MESSAGE = "{}".format(i) #sleep for an arbitrary amount of time. Currently 0.2 settings for visual testing. time.sleep(0.2)