Can someone translate a small .PY to Perl?

From: GMane Python (s_david_rose_at_hotmail.com)
Date: 12/27/04


To: beginners@perl.org
Date: Mon, 27 Dec 2004 14:48:30 -0500

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?
        I am beginning to learn the Python language after a 10-year
programming 'vacation' from my last class in college. Looking at this, I
think it'll end up being a rather quick translation, but although I'm
searching for translations, I'd really like to be able to just get my
Netware server to send heartbeats and not take flack from my boss for
'having to learn PERL' just to get the server to send a beat packet, so
that's why I'm asking for someone's help who knows the syntax of the
language.

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)



Relevant Pages

  • Re: PyHeartBeat Client in PERL?
    ... Dave> came across the script by Dave Larosa. ... Dave> PERL, I was wondering if there were a translation in PERL so I ... Dave> could have my Netware servers send heartbeats to the heartbeat ... remote server, after all). ...
    (comp.lang.python)
  • ANNOUNCE: UnixODBC 0.31
    ... UnixODBC provides a toolkit for writing Perl ODBC clients. ... - Installing and Configuring the Bridge Server ... UnixODBC.pm provides Perl programs with a subset of the X/Open ... Bridge Server," below. ...
    (comp.lang.perl.modules)
  • POP3 Mail Client in PERL using IO::Socket module only and regular expressions
    ... I am writing a POP3 Client program in Perl. ... Server and have a running conversation with the mail server using ... print $socket "STAT",CRLF; ...
    (comp.lang.perl.misc)
  • Re: [ANN] Ruby Hacking Guide - New chapters (and a bonus)
    ... Here they are, translations of chapter 3, 4 and 6 of the Ruby Hacking Guide! ... We know the translation is far from being perfect, ... Perl is Ruby's big brother ... What are your complaints towards Unicode? ...
    (comp.lang.ruby)
  • Solved: Perl/NFS "Text File Busy" Error And Related Problems
    ... Â That means I am actually editing the Perl file on ... and I am running it on another (my server). ... The first problem I had was that when I saved my script through NFS, ... apt-get install nfs-kernel-server ...
    (Debian-User)