Skip to content

Instantly share code, notes, and snippets.

@yychen
Created November 12, 2018 12:14
Show Gist options
  • Save yychen/a0aca434fdf6502d1497bf2ce519a124 to your computer and use it in GitHub Desktop.
Save yychen/a0aca434fdf6502d1497bf2ce519a124 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import socket
import time
UDP_HOST = '0.0.0.0'
UDP_PORT = 3838
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((UDP_HOST, UDP_PORT))
while True:
data, addr = sock.recvfrom(1024)
print('Received: ', data)
time.sleep(0.05)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment