Use correct ip
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Dominik Heidler 2023-11-04 00:04:15 +01:00
parent 7c7397d7a7
commit 511d58e9c5

View file

@ -26,11 +26,11 @@ while True:
ips = pl.split("\t")[3]
for ip in ips.split(","):
if ip.endswith("/32"):
print(ip[:-3])
print(f"{ip}:{UDP_PORT} {MESSAGE=}" % MESSAGE)
UDP_IP = ip[:-3]
print(f"{UDP_IP}:{UDP_PORT} {MESSAGE=}" % MESSAGE)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sock.bind(('0.0.0.0', 1900)) # 1900 is SSDP src port
sock.sendto(MESSAGE, (ip, UDP_PORT))
sock.sendto(MESSAGE, (UDP_IP, UDP_PORT))
sock.close()
time.sleep(10)