Skip to content

Instantly share code, notes, and snippets.

@amitittyerah
Created April 18, 2014 08:02
Show Gist options
  • Save amitittyerah/11030648 to your computer and use it in GitHub Desktop.
Save amitittyerah/11030648 to your computer and use it in GitHub Desktop.
Python UDP Port Listener
import socket
import select
PORT = 1002
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(('0.0.0.0', PORT))
while True:
package, w, x = select.select([sock], [], [])
for pack in package:
print pack, pack.recvfrom(131072)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment