Hey, gents!

I'm making my first foray into the world of IO::Sockets, and, for the most part, it seems fairly straightforward. The one thing I'm having a bit of trouble with, however, is a test for whether a connection is actually /live/.

A bit of background:

As a pet project, I'm working on a website content aggregator - a very simple thing. Essentially, it's a piece of server code that sits and waits for a query from a simple cgi script, then, in turn, goes out and uses TCP to acquire data from other sites - a 'bot. Fairly simple.

I'm trying to trap the case of 'what happens when that connection is broken, and I need to reconnect before I can actually return data'. Is there a simple test for connectivity I can implement to see if a connection's idled out or otherwise gone stale?

A server reboot, for instance, on the far end, leaves me with a dead connection and no indication that it's dropped.

What's the usual way of monitoring this sort of thing? Grimm


In reply to An IO::Sockets 'test for live connection' question: by jonahgrimm

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.