MonoMobile.Views.Reachability.RemoteHostStatus C# (CSharp) Method

RemoteHostStatus() public static method

public static RemoteHostStatus ( ) : NetworkStatus
return NetworkStatus
		public static NetworkStatus RemoteHostStatus()
		{
			NetworkReachabilityFlags flags;
			bool reachable;
			
			if (remoteHostReachability == null)
			{
				remoteHostReachability = new NetworkReachability(HostName);
	
				// Need to probe before we queue, or we wont get any meaningful values
				// this only happens when you create NetworkReachability from a hostname
				reachable = remoteHostReachability.TryGetFlags(out flags);
				
				remoteHostReachability.SetCallback(OnChange);
				remoteHostReachability.Schedule(CFRunLoop.Current, CFRunLoop.ModeDefault);
			}
			else
			{
				reachable = remoteHostReachability.TryGetFlags(out flags);
			}			
			
			if (!reachable)
			{
				return NetworkStatus.NotReachable;
			}
	
			if (!IsReachableWithoutRequiringConnection(flags))
			{
				return NetworkStatus.NotReachable;
			}
			
			if ((flags & NetworkReachabilityFlags.IsWWAN) != 0)
			{
				return NetworkStatus.ReachableViaCarrierDataNetwork;
			}
					
			return NetworkStatus.ReachableViaWiFiNetwork;
		}