Skip to content

Instantly share code, notes, and snippets.

@pc-coholic
Last active December 1, 2016 20:37
Show Gist options
  • Save pc-coholic/103a3ce298a3556a8b45a747eca841cf to your computer and use it in GitHub Desktop.
Save pc-coholic/103a3ce298a3556a8b45a747eca841cf to your computer and use it in GitHub Desktop.
import socket
UDP_IP = "0.0.0.0"
UDP_PORT = 2080
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind((UDP_IP, UDP_PORT))
while True:
data, addr = sock.recvfrom(1024)
print "received from:", addr[0], addr[1]
print "received message:", data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment