I have a function that at the moment does a quick ping to a remote machine in the same network by doing so:
ping -n 1
It then evaluates the commands success (1 or 0) in order to determine whether the machine is powered on or not.
Seems that this approach is not working correctly as I will indeed get 1 from ping only if the DNS resolution for the IP am trying to ping fails. In any other case it seems that ping will return zero (even if the machine is indeed down) as it seems to loopback on itself.
Does anyone have a good idea for any suitable alternatives? I am considering telnet but this may take a long time to timeout and I want the best possible performance.