A while back I wrote a script that listens on a UDP port for syslog type messages from a bunch of sonicwall firewalls. It parses interesting information out and saves it into a sql database from which we do reports. My problem is that the NT service that sends the syslog messages to the machine that my script lives on, locks up, dies or otherwise ceases to send info. If I restart the service on the other machine everything works again. My question is how do I get the script to tell me it hasn't received any info in a while so I know when to do something about this service? I looked into using timeout but it doesn't seem to do what I want. I am about to look into noting the time between messages coming in and when the time is more than X notify someone (or maybe remotely restart the service on the other machine, but that is another problem). Does anyone know a feature of IO:Socket or some other method of noticing the LACK of traffic on a UDP port?

In reply to Checking for no traffic on a port by Ugmo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.