Merge branch 'ChaosChemnitz' of https://git.chch.it/ChCh/CloudBot_github into ChaosChemnitz
Conflicts: plugins/chch_worker.py
This commit is contained in:
commit
29cc95f0ad
1 changed files with 6 additions and 6 deletions
|
@ -20,16 +20,16 @@ def run_ecmd(cmd):
|
|||
def run_udp(cmd):
|
||||
ip="127.0.0.1"
|
||||
port=49152
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
# 10 ms timeout
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
# 100 ms timeout
|
||||
s.settimeout(0.1)
|
||||
s.sendto(cmd, (ip, port))
|
||||
s.connect((ip, port))
|
||||
s.send(cmd)
|
||||
try:
|
||||
rec = s.recvfrom(1024)[0]
|
||||
rec = s.recv(1024)
|
||||
except:
|
||||
rec = ""
|
||||
s.close()
|
||||
print(rec)
|
||||
return rec
|
||||
|
||||
# lamp_lounge handling
|
||||
|
@ -47,7 +47,7 @@ def cmd_lamp_lounge(inp, reply=None):
|
|||
|
||||
c = "a\x00\x03" + struct.pack('BBB', int(args[0][2:4], 16), int(args[0][0:2], 16), int(args[0][4:6], 16))
|
||||
|
||||
rep = run_udp(c)
|
||||
rep = run_tcp(c)
|
||||
|
||||
if len(rep) < 3:
|
||||
reply("Error: no reply")
|
||||
|
|
Reference in a new issue