in reply to Re^4: uninitialized values
in thread uninitialized values
Can you please add comments to your code with examples of what the ping returns in each case. I think you may be looking for several different failure modes:
Can not resolve name to IP
Can not reach that IP
That IP is not responding
As different OS/Ping combinations have different results it is hard for us to know what you are looking at in each case. If you add an example of each, in a comment before the related if statement, it will make debugging much easier. Not just for your fellow monks, but also for future maintainers of your code, including your future self.
Pereant, qui ante nos nostra dixerunt!