Created
January 15, 2016 12:03
-
-
Save a-andreyev/8acc4722158dab9e194a to your computer and use it in GitHub Desktop.
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
from socket import * | |
UDP_IP="192.168.0.255" | |
UDP_PORT=8888 | |
MESSAGE="UPD IS AWESOME" | |
print("UDP target IP:", UDP_IP) | |
print("UDP target port:", UDP_PORT) | |
print("message:", MESSAGE) | |
sock = socket(AF_INET, SOCK_DGRAM) | |
sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1) | |
sock.setsockopt(SOL_SOCKET, SO_BROADCAST, 1) | |
sock.sendto(bytes(MESSAGE, "utf-8"), (UDP_IP, UDP_PORT)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment