in reply to Telnet session disconnect testing

I think this is wrong:

while (<$sock>) {

Looking at perldoc IO::Socket, you need one or two things:

TCP has a teardown sequence: the sender closes its port; the receiver acknowledges the close and closes its own. . It's very unlikely that rebooting the PBX interferes with that. Your TCP stack knows the sender is gone, but because you're not timing out, you never learn of it.

Replies are listed 'Best First'.
Re^2: Telnet session disconnect testing
by bajangerry (Sexton) on Jan 15, 2010 at 16:47 UTC

    jklowden

    Thanks for the response but I am not sure I get your point here. I was assuming that the  while (<$sock>) would provide a means of checking that the link was up and if it is then continue.

    I have checked a few examples of using the IO::Socket::INET and I have not seen anyone using a timeout option so I am not sure how I could implement that, could you explain bit more for me? Maybe an example of it in my code?