in reply to Re: Ping and check for server running on port 27015
in thread Ping and check for server running on port 27015

While i haven't a comment on the socket side of your code, you may want to reverse the logic of your $connected flag. Intuitively, if I see a flag such as "$connected", the assumption is that a true value would mean we are conencted.

Then you can say something like:

if ( $connected) { print " Port $port is up.\n"; } else { print " Port $port is down.\n"; }
That also means you will have to reverse the logic in your "or" modifier, but your program will more intuitive and easier to maintain.