2019-01-05 Fred Gleason <fredg@paravelsystems.com>

* Added keep-alive packet support to the 'pypad_ando.py' PyPAD
	script.
This commit is contained in:
Fred Gleason
2019-01-05 16:13:01 -05:00
parent 2307b119e5
commit 5b240c0814
2 changed files with 15 additions and 0 deletions

View File

@@ -30,6 +30,17 @@ last_updates={}
def eprint(*args,**kwargs):
print(*args,file=sys.stderr,**kwargs)
def ProcessTimer(config):
n=1
while(True):
section='System'+str(n)
try:
send_sock.sendto('HB'.encode('utf-8'),
(config.get(section,'IpAddress'),int(config.get(section,'UdpPort'))))
n=n+1
except configparser.NoSectionError:
return
def ProcessPad(update):
try:
last_updates[update.machine()]
@@ -73,4 +84,5 @@ except IndexError:
eprint('pypad_ando.py: you must specify a configuration file')
sys.exit(1)
rcvr.setCallback(ProcessPad)
rcvr.setTimerCallback(30,ProcessTimer)
rcvr.start(sys.argv[1],int(sys.argv[2]))