OurCurrentIpAddress = "";

	List<NetworkingUtilities.NetworkAdapterInfo> NetworkAdapters = NetworkingUtilities1.GetNetworkInterfaceInformation_GetResult();
	if (NetworkAdapters != null)
	{
		//----- LOOK FOR NETWORK ADAPTER THAT ARE CONNECTED -----
		foreach (NetworkingUtilities.NetworkAdapterInfo NetworkInfo in NetworkAdapters)
		{
			if (NetworkInfo.NetworkName != "VirtualNetworkAdapter")
			{
				//This is a WiFi network adapter
				//You can read:
				/*
				NetworkInfo.NetworkName
				NetworkInfo.NetworkStatus		//<ConnectionStatus. String, Can't find any explanations on possible values. "InternetAccess" is one
				if (NetworkInfo.NetworkIpv4.Length > 0)
					Values.Add(NetworkInfo.NetworkIpv4);		//<IP address
				else
					Values.Add(NetworkInfo.NetworkIpv6);
				*/

				/*
				if (NetworkInfo.NetworkName != "Ethernet")
				{
					//WiFi Adapter

				}
				else
				{
					//Ethernet Adapter

				}
				*/

				if (NetworkInfo.NetworkIpv4.Length > 0)
				{
					OurCurrentIpAddress = NetworkInfo.NetworkIpv4;
					break;				//No point getting any more, we only care if there's at least one connected
				}

			}
		}


		//Get IP address operation completed
		if (OurCurrentIpAddress.Length > 0)
		{
			//----- WE HAVE AN IP ADDRESS -----
			//We have IP address so we are connected

		}
	}
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through resources like this. We hope you find it helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support here. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *