ios-hooks/testudp.py
2025-11-18 13:48:04 +08:00

24 lines
496 B
Python

import socket
data = """
{
"url": "/start"
}
""".encode('utf-8')
with open('./ips.txt', 'r') as f:
for ip in f.readlines():
print(ip.strip())
try:
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.settimeout(5)
# 发送数据:
s.sendto(data, (ip.strip(), 6001))
# 接收数据:
print(s.recv(1024).decode('utf-8'))
s.close()
except Exception as e:
print(e)