Created
August 28, 2021 14:59
-
-
Save DenchiSoft/51cd5c967ef3b77d957ec136ecf443d2 to your computer and use it in GitHub Desktop.
This file contains 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 | |
from socket import timeout | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0) | |
s.bind(("0.0.0.0", 47779)); | |
s.settimeout(0.5) | |
while True: | |
try: | |
data, address = s.recvfrom(4096) | |
print("Received: ", data.decode('utf-8')) | |
except timeout: | |
print("Scanning for broadcasts") | |
s.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment