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

A send/write of zero bytes will do the trick, I believe. BTW, we're not all gents!
  • 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 sgifford (Prior) on Mar 02, 2007 at 06:58 UTC
    In some quick tests on my system, a syswrite or send of 0 bytes doesn't seem to send any data across the network, which means it won't detect a host that has disappeared (though it will detect a connection that the OS already knows is dead).

    Have you tried this and did it work? It would be extremely useful to have some way to probe a connection in this way, and the protocol supports it, but unfortunately the OS doesn't seem to provide a way to access this functionality.

    Thanks!

      I used this technique years ago in a C/Unix environment, haven't tried it with Perl. YMMV.