Journal dmorin's Journal: Detecting a net connection
For a long time the answer was no. But JDK1.4 introduced "NetworkInterface" which has potential. I've already written a little utility that looks at a known set of interfaces (such as wlan0 and eth0 on my laptop). If either one is not null, then it assumes network is available. It seems to work correctly -- I yank out my pcmcia net card and it immediately switches to false, I put it back and it goes true again.
The problem is that doesn't work on Windows (apparently). The interface on my NT machine, "lan0", appears to always exist. And on a desktop machine this makes sense, since technically the interface does exist it's just not connected -- that's a different condition.
Is there a way in windows to "down" an interface, like "ifdown" in Linux?
Detecting a net connection More Login
Detecting a net connection
Slashdot Top Deals