PyHeartBeat Client in PERL?

GMane Python s_david_rose at hotmail.com
Mon Dec 27 13:57:42 EST 2004


      Hello Everyone.

        Whil e reading the Python Cookbook as a means of learning Python, I
came across the script by Nicola Larosa.  Not knowing anything about PERL, I
was wondering if there were a translation in PERL so I could have my Netware
servers send heartbeats to the heartbeat server?  Thanks!

      Dave



      Title: PyHeartbeat - detecting inactive computers
      Submitter: Nicola Larosa





      # Filename: HeartbeatClient.py

      """Heartbeat client, sends out an UDP packet periodically"""

      import socket, time

      SERVER_IP = '127.0.0.1'; SERVER_PORT = 43278; BEAT_PERIOD = 5

      print ('Sending heartbeat to IP %s , port %d\n'
          'press Ctrl-C to stop\n') % (SERVER_IP, SERVER_PORT)
      while True:
          hbSocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
          hbSocket.sendto('PyHB', (SERVER_IP, SERVER_PORT))
          if __debug__: print 'Time: %s' % time.ctime()
          time.sleep(BEAT_PERIOD)







More information about the Python-list mailing list