Created
December 27, 2016 23:35
-
-
Save mpontillo/ce63883ccac700472afca7f6295c2045 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
#!/usr/bin/env python | |
import socket | |
import time | |
servers = [ | |
["Local Network - Survival Peaceful", 25565], | |
["Local Network - Survival Normal", 25566], | |
["Local Network - Survival Hard with Diamonds", 25567], | |
] | |
# BROADCAST_IP = "255.255.255.255" | |
BROADCAST_IP = "224.0.2.60" | |
BROADCAST_PORT = 4445 | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) | |
print "Broadcasting Minecraft servers to LAN..." | |
while 1: | |
for server in servers: | |
msg = "[MOTD]%s[/MOTD][AD]%d[/AD]" % (server[0], server[1]) | |
sock.sendto(msg, (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