erst 2 zeichen per udp hinsenden:
chr(0x5c) und chr(0x62)
was etwa \b ergibt.
nun hab ich soweit schon das folgende py skript:
Code: Alles auswählen
# SWAT4 Server status script
from socket import *
import time
host = "89.239.3.11"
port = 10420
buf = 1024
addr = (host,port)
udp = socket(AF_INET,SOCK_DGRAM)
packet = chr(0x5c) + chr(0x62)
print "Send data..."
print packet;
udp.sendto(packet, addr)
starttime = time.clock()
data = ""
while 1:
print "Recieving..."
try:
d, addr = udp.recvfrom(buf)
except:
print "-- Socket hang up"
break
if not d:
print "-- No data"
break
if starttime+5 < time.clock():
print "-- Time out"
break
data = data + d;
if data.find("\\final\\\\") > -1: #<-- ende der status daten
print "-- Data read"
break
print "Recieved Data:\n"
print data
kann ich da irwie was tun?
try- except geht nicht.
timeout mit time.clock() geht nicht
auch das überprüfen ob d was enthält geht nicht..