Is there any way in Java to receive event notifications whenever link state changes on a computer (connected, disconnected, up, down, etc)? Thanks!
Asked
Active
Viewed 561 times
1 Answers
2
There is no platform-independent mechanism which accomplishes this in Java. However, you can use JNI to do it. For example, Windows allows you to poll (or be notified of) network interface states using the Network Location Awareness (NLA) API.

Zack Angelo
- 425
- 3
- 8
-
Thanks BigZig. Another two APIs I found are Windows [Network List Manager][1] and [ISensNetwork][2]. They both can actually push link state notifications, but NLM only supports Vista and above, and ISensNetowrk can't work reliably, according to some posts online :( [1]: http://msdn.microsoft.com/en-us/library/aa370803(VS.85).aspx [2]: http://msdn.microsoft.com/en-us/library/aa377384(v=VS.85).aspx – wwh37 Apr 29 '10 at 01:54
-
Wondering why SO doesn't render my links correctly. Try again: Network List Manager and ISensNetwork. – wwh37 Apr 29 '10 at 02:01
-
I am using NotifyIpInterfaceChange() API from IP Helper Functions: http://goo.gl/KTzfJ It works fine but delivers about a 5-10 notifications on each change, so I'm collecting them in a "batch" and report only once. – tuxSlayer Mar 26 '12 at 12:56