in reply to An IO::Sockets 'test for live connection' question:

i suppose it would depend on the protocol you expect to be using. for instance, if its standard HTTP protocol, you could send a HEAD request to see if its alive (being sure to set a timeout first), or if its FTP protocol, you could send a NOOP request. you could then factor that check into a subroutine, and call it before each actual request you make.

Of course, if you're using a standard protocol, you can probably find an existing module to handle the low-level stuff for you and avoid sockets altogether (one of the many LWP modules for instance).

__________
Systems development is like banging your head against a wall...
It's usually very painful, but if you're persistent, you'll get through it.

  • Comment on Re: An IO::Sockets 'test for live connection' question:

Replies are listed 'Best First'.
Re^2: An IO::Sockets 'test for live connection' question:
by jonahgrimm (Acolyte) on Mar 02, 2007 at 16:30 UTC

    It's pure TCP, as it currently stands. In essence, I'm trying to suck telnet-type output into a web page front end on-demand. I've tried Net::Telnet, but I can't see a single method in the module for holding a connection open - it's great for sending a series of instructions (a-la SMTP services or even connecting to a TCP music server), but not so great for holding a connection open.

    Then again, I admit that I'm fairly new to the idea of multithreading, and holding connections open and in-state, thus my existing code certainly isn't very elegant.

    The fun part of being a newbie is learning that sort of thing, anyway. :)

    Grimm