#! /usr/bin/env python
#
"""
PyHeartBeat client
It sends out an UDP packet every 10 seconds
Please adjust the constant parameters as needed
"""
from socket import socket, AF_INET, SOCK_DGRAM
from time import time, ctime, sleep
SERVERIP = '127.0.0.1'
HBPORT = 43278
BEATWAIT = 2
print "PyHeartBeat client sending to IP %s , port %d" % (SERVERIP, HBPORT)
print "\n*** Press Ctrl-C to stop ***\n"
while 1:
hbsocket = socket(AF_INET, SOCK_DGRAM)
hbsocket.sendto('Bing!', (SERVERIP, HBPORT))
if __debug__:
print "Time: %s" % ctime(time())
sleep(BEATWAIT)