fix test for server running

This commit is contained in:
clinton-hall 2013-04-15 16:54:09 +09:30
commit 892c0837a6

View file

@ -238,10 +238,8 @@ def WakeOnLan(ethernet_address):
#Test Connection function
def TestCon(host, port):
(family, socktype, proto, garbage, address) = socket.getaddrinfo(host, port)[0]
s = socket.socket(family, socktype, proto)
try:
s.connect(address)
socket.create_connection((host, port))
return "Up"
except:
return "Down"
@ -262,7 +260,7 @@ def WakeUp():
Logger.info("Loading WakeOnLan config from %s", configFilename)
config.get("WakeOnLan", "host")
host = config.get("WakeOnLan", "host")
port = config.get("WakeOnLan", "port")
port = int(config.get("WakeOnLan", "port"))
mac = config.get("WakeOnLan", "mac")
i=1