Skip to content

Instantly share code, notes, and snippets.

@yychen
Created November 12, 2018 12:14
Show Gist options
  • Save yychen/bde3d6ba43b622274e739decc436759c to your computer and use it in GitHub Desktop.
Save yychen/bde3d6ba43b622274e739decc436759c to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import socket
UDP_IP = "127.0.0.1"
UDP_PORT = 3838
# MESSAGE = "\nter 0.78\nmaster 0.4\nmaster 0.5"
MESSAGE = "This is a test....\n\n"
print("UDP target IP:", UDP_IP)
print("UDP target port:", UDP_PORT)
print("message:", MESSAGE)
sock = socket.socket(socket.AF_INET, # Internet
socket.SOCK_DGRAM) # UDP
sock.sendto(bytes(MESSAGE, 'utf-8'), (UDP_IP, UDP_PORT))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment