-
-
Save thorsummoner/f813655849e598de29b977b84255d7cc to your computer and use it in GitHub Desktop.
Minecraft Server Advertizements
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
#!/usr/bin/env python3 | |
import time | |
import socket | |
servers = [ | |
["MOTD", 25565], | |
] | |
BROADCAST_IP = "255.255.255.255" | |
BROADCAST_PORT = 4445 | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) | |
while 1: | |
for server in servers: | |
msg = "[MOTD]%s[/MOTD][AD]%d[/AD]" % (server[0], server[1]) | |
sock.sendto(msg.encode('utf-8'), (BROADCAST_IP, BROADCAST_PORT)) | |
time.sleep(1.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment