Skip to content

Instantly share code, notes, and snippets.

@ricklentz
Created May 25, 2017 01:56
Show Gist options
  • Save ricklentz/a2bd3e174c760b75e7f555ec16fb3748 to your computer and use it in GitHub Desktop.
Save ricklentz/a2bd3e174c760b75e7f555ec16fb3748 to your computer and use it in GitHub Desktop.
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 24000
my_bytes = bytearray(1)
print ("UDP target IP:", UDP_IP)
print ("UDP target port:", UDP_PORT)
print ("message:", my_bytes)
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.sendto(my_bytes, (UDP_IP, UDP_PORT))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment