This content has been marked as final. Show 3 replies
Code fails if VM connections are availableThe code does exactly what it is supposed to do if there are VM connections available.
More to the point, what exactly is the point? The best way to tell whether any resource is available is to try to use it, and handle the error or exceptions that result when it isn't. Trying to second-guess how the system decides that is futile and error-prone. If you want to use the network, just use it.
I want some behaviour when network is unavailble.
For that i had disconnected the network cable and used above code.
But still it says that network is available by returning true value.
And this isn't the case with all the machines.
So i found that machines having multiple network adapters or having VM connection have this problem.
So how to find this in code?