Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save HavishNetla/becaff4b4fd92dddab44275f66f200b3 to your computer and use it in GitHub Desktop.
Save HavishNetla/becaff4b4fd92dddab44275f66f200b3 to your computer and use it in GitHub Desktop.
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 8221
MESSAGE = "Hello, World!"
print ("UDP target IP:" + "127.0.0.1")
print ("UDP target port:" + "8221")
print ("message:" + MESSAGE)
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
while True:
print ("message:" + MESSAGE)
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment