[Mono-dev] Testing if there is a network connection or not

Miguel de Icaza miguel at novell.com
Sun Feb 11 23:16:04 EST 2007

> I'm currently using System.Management.ManagementObjectSearcher on VS.NET
> to check if there is a network connection or not. This looks to be
> implemented under Win32 but dead under Linux.
> Is there another way to check if there is a connection or not without
> using S.M.ManagementObjectSearcher?

You have a number of options, you can try:

	* DBus# and send a message to NetworkManager to determine if 
	  you are connected or not (will only work on distros with NM)

	* If NM is not running, you could try the list of ethernet
	  interfaces in /proc/net (will only work on Linux) and see if
	  they are up.


More information about the Mono-devel-list mailing list