Exemplo n.º 1
0
        /// <summary>
        /// Checks to see if a domain is available for registration asynchronously specifying the specified host, domain to query and the string indicates the domain doesn't exist.
        /// </summary>
        /// <param name="host">Host of the whois server.</param>
        /// <param name="port">Port of the whois server.</param>
        /// <param name="domainToQuery">Domain to query.</param>
        /// <param name="callBack">Callback function</param>
        /// <returns>IAsyncResult object that represents the result of the IsAvailableAsync operation.</returns>
        /// <example>
        /// <code>
        /// [C#]
        /// 
        /// WhoIs whoIs = new WhoIs();
        /// IAsyncResult state = whoIs.QueryAsync("activeup.com",43,new AsyncCallback(MyCallbackIsAvailable));
        /// 
        /// public void MyCallbackIsAvailable(IAsyncResult state)
        /// {
        ///        try
        ///        {
        ///            bool result = whoIs.IsAvailableAsyncResult(state);
        ///            if (result == true)
        ///                Console.WriteLine("The domain is available for registration.");
        ///            else
        ///                Console.WriteLine("The domain is NOT available for registration.");
        ///            
        ///        }
        ///
        ///        catch(WhoisException we)
        ///        {
        ///            Console.WriteLine("WhoisException : " + we.Message);
        ///        }
        ///
        ///        catch(Exception ex)
        ///        {
        ///            Console.WriteLine("An unhandled exception was thrown : " + ex.Message);
        ///        }
        /// }
        /// 
        /// [VB.NET] 
        /// 
        /// Private whoIs As whoIs = New whoIs()
        /// Dim state As IAsyncResult = whoIs.IsAvailableAsync("activeup.com",43, New AsyncCallback(AddressOf MyCallbackIsAvailable))
        /// 
        /// Public Sub MyCallbackIsAvailable(ByVal state As IAsyncResult)
        ///
        ///        Try
        ///            Dim result As Boolean = whoIs.IsAvailableAsyncResult(state)
        ///            If (result = True) Then
        ///                Console.WriteLine("The domain is available for registration.")
        ///            Else
        ///                Console.WriteLine("The domain is NOT available for registration.")
        ///            End If
        ///
        ///        Catch we As WhoisException
        ///            Console.WriteLine("WhoisException : " + we.Message)
        ///
        ///        Catch ex As Exception
        ///            Console.WriteLine("An unhandled exception was thrown : " + ex.Message)
        ///
        ///        End Try
        ///
        ///    End Sub
        /// </code>
        /// </example>
        public IAsyncResult IsAvailableAsync(string host, int port, string domainToQuery,AsyncCallback callBack)
        {
            ServerCollection servers = new ServerCollection();
            servers.Add(new Server(host,port));

            _isAvailableDelegate = new IsAvailableDelegate(_IsAvailable);
            return _isAvailableDelegate.BeginInvoke(servers,domainToQuery,callBack,null);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Checks to see if a domain is available for registration asynchronously specifying the specified ServerCollection object and domain to query.
 /// </summary>
 /// <param name="servers">Collection contening a list of whois server.</param>
 /// <param name="domainToQuery">Domain to query.</param>
 /// <param name="callBack">Callback function.</param>
 /// <returns>IAsyncResult object that represents the result of the IsAvailableAsync operation.</returns>
 /// <example>
 /// <code>
 /// [C#]
 /// 
 /// ServerCollection servers = new ServerCollection();
 /// 
 ///    Server server1 = new Server();
 ///    server1.Host = "whois.networksolutions.com";
 ///    server1.Port = 43;
 ///    server1.Domain = ".com";
 ///    server1.NoMatch = "no match";
 ///    servers.Add(server1);
 /// 
 ///    Server server2 = new Server();
 ///    server2.Host = "whois.nic.co.uk";
 ///    server2.Port = 43;
 ///    server2.Domain = ".co.uk";
 ///    server2.NoMatch = "no match";
 ///    servers.Add(server2);
 /// 
 /// WhoIs whoIs = new WhoIs();
 /// IAsyncResult state = whoIs.QueryAsync(servers,new AsyncCallback(MyCallbackIsAvailable));
 /// 
 /// public void MyCallbackIsAvailable(IAsyncResult state)
 /// {
 ///        try
 ///        {
 ///            bool result = whoIs.IsAvailableAsyncResult(state);
 ///            if (result == true)
 ///                Console.WriteLine("The domain is available for registration.");
 ///            else
 ///                Console.WriteLine("The domain is NOT available for registration.");
 ///            
 ///        }
 ///
 ///        catch(WhoisException we)
 ///        {
 ///            Console.WriteLine("WhoisException : " + we.Message);
 ///        }
 ///
 ///        catch(Exception ex)
 ///        {
 ///            Console.WriteLine("An unhandled exception was thrown : " + ex.Message);
 ///        }
 /// }
 /// 
 /// [VB.NET] 
 /// 
 /// Private whoIs As whoIs = New whoIs()
 /// 
 ///    Dim server1 As New Server()
 ///    server1.Host = "whois.networksolutions.com"
 ///    server1.Port = 43
 ///    server1.Domain = ".com"
 ///    server1.NoMatch = "no match"
 ///    servers.Add(server1)
 ///
 ///    Dim server2 As New Server()
 ///    server2.Host = "whois.nic.co.uk"
 ///    server2.Port = 43
 ///    server2.Domain = ".co.uk"
 ///    server2.NoMatch = "no match"
 ///    servers.Add(server2)
 /// 
 /// Dim state As IAsyncResult = whoIs.IsAvailableAsync(servers,"activeup.com", New AsyncCallback(AddressOf MyCallbackIsAvailable))
 /// 
 /// Public Sub MyCallbackIsAvailable(ByVal state As IAsyncResult)
 ///
 ///        Try
 ///            Dim result As Boolean = whoIs.IsAvailableAsyncResult(state)
 ///            If (result = True) Then
 ///                Console.WriteLine("The domain is available for registration.")
 ///            Else
 ///                Console.WriteLine("The domain is NOT available for registration.")
 ///            End If
 ///
 ///        Catch we As WhoisException
 ///            Console.WriteLine("WhoisException : " + we.Message)
 ///
 ///        Catch ex As Exception
 ///            Console.WriteLine("An unhandled exception was thrown : " + ex.Message)
 ///
 ///        End Try
 ///
 ///    End Sub
 /// </code>
 /// </example>
 public IAsyncResult IsAvailableAsync(ServerCollection servers, string domainToQuery,AsyncCallback callBack)
 {
     _isAvailableDelegate = new IsAvailableDelegate(_IsAvailable);
     return _isAvailableDelegate.BeginInvoke(servers,domainToQuery,callBack,null);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Checks to see if a domain is available for registration asynchronously specifying the domain to query.
 /// </summary>
 /// <param name="domainToQuery">Domain to query.</param>
 /// <param name="callBack">Callback function</param>
 /// <returns>IAsyncResult object that represents the result of the IsAvailableAsync operation.</returns>
 /// <example>
 /// <code>
 /// [C#]
 /// 
 /// WhoIs whoIs = new WhoIs();
 /// IAsyncResult state = whoIs.QueryAsync("activeup.com",new AsyncCallback(MyCallbackIsAvailable));
 /// 
 /// public void MyCallbackIsAvailable(IAsyncResult state)
 /// {
 ///        try
 ///        {
 ///            bool result = whoIs.IsAvailableAsyncResult(state);
 ///            if (result == true)
 ///                Console.WriteLine("The domain is available for registration.");
 ///            else
 ///                Console.WriteLine("The domain is NOT available for registration.");
 ///            
 ///        }
 ///
 ///        catch(WhoisException we)
 ///        {
 ///            Console.WriteLine("WhoisException : " + we.Message);
 ///        }
 ///
 ///        catch(Exception ex)
 ///        {
 ///            Console.WriteLine("An unhandled exception was thrown : " + ex.Message);
 ///        }
 /// }
 /// 
 /// [VB.NET] 
 /// 
 /// Private whoIs As whoIs = New whoIs()
 /// Dim state As IAsyncResult = whoIs.IsAvailableAsync("activeup.com", New AsyncCallback(AddressOf MyCallbackIsAvailable))
 /// 
 /// Public Sub MyCallbackIsAvailable(ByVal state As IAsyncResult)
 ///
 ///        Try
 ///            Dim result As Boolean = whoIs.IsAvailableAsyncResult(state)
 ///            If (result = True) Then
 ///                Console.WriteLine("The domain is available for registration.")
 ///            Else
 ///                Console.WriteLine("The domain is NOT available for registration.")
 ///            End If
 ///
 ///        Catch we As WhoisException
 ///            Console.WriteLine("WhoisException : " + we.Message)
 ///
 ///        Catch ex As Exception
 ///            Console.WriteLine("An unhandled exception was thrown : " + ex.Message)
 ///
 ///        End Try
 ///
 ///    End Sub
 /// </code>
 /// </example>
 public IAsyncResult IsAvailableAsync(string domainToQuery,AsyncCallback callBack)
 {
     _isAvailableDelegate = new IsAvailableDelegate(_IsAvailable);
     return _isAvailableDelegate.BeginInvoke(null,domainToQuery,callBack,null);
 }