Exemplo n.º 1
0
        static void OnCompleted(object sender, SimpleResolverEventArgs e)
        {
            DnsAsyncResult ares  = (DnsAsyncResult)e.UserToken;
            IPHostEntry    entry = e.HostEntry;

            if (entry == null || e.ResolverError != 0)
            {
                ares.SetCompleted(false, new Exception("Error: " + e.ResolverError));
                return;
            }
            ares.SetCompleted(false, entry);
        }
Exemplo n.º 2
0
        static IAsyncResult BeginAsyncCallAddresses(string host, AsyncCallback callback, object state)
        {
            SimpleResolverEventArgs e = new SimpleResolverEventArgs();

            e.Completed += OnCompleted;
            e.HostName   = host;
            DnsAsyncResult ares = new DnsAsyncResult(callback, state);

            e.UserToken = ares;
            if (resolver.GetHostAddressesAsync(e) == false)
            {
                ares.SetCompleted(true, e.HostEntry);                  // Completed synchronously
            }
            return(ares);
        }
Exemplo n.º 3
0
Arquivo: Dns.cs Projeto: westybsa/mono
		static IAsyncResult BeginAsyncCall (string host, AsyncCallback callback, object state)
		{
			SimpleResolverEventArgs e = new SimpleResolverEventArgs ();
			e.Completed += OnCompleted;
			e.HostName = host;
			DnsAsyncResult ares = new DnsAsyncResult (callback, state);
			e.UserToken = ares;
			if (resolver.GetHostEntryAsync (e) == false)
				ares.SetCompleted (true, e.HostEntry); // Completed synchronously
			return ares;
		}