Created
April 18, 2014 08:02
-
-
Save amitittyerah/11030648 to your computer and use it in GitHub Desktop.
Python UDP Port Listener
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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