Exemple #1
0
        /// <summary>
        ///  Query all the whois server specifying list of whois servers and the top level domain asynchronously
        ///  </summary>
        /// <returns>IAsyncResult object that represents the result of the GlobalQueryAsync operation.</returns>
        /// <example>
        ///     <code lang="CS">
        /// WhoIs whoIs = new WhoIs();
        ///  
        /// 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);
        ///             
        ///     IAsyncResult state = whoIs.GlobalQueryAsync(servers,"activeup",new AsyncCallback(MyCallbackGlobalWhoIs));
        ///     
        ///     public static void MyCallbackGlobalWhoIs(IAsyncResult state)
        ///     {
        ///         try
        ///         {
        ///             ResultQueryCollection results = whoIs.GlobalQueryAsyncResult(state);
        ///  
        ///             foreach(ResultQuery result in results)
        ///             {
        ///                 Console.WriteLine(result.Result);
        ///                 Console.WriteLine(result.ServerUsed.Host);
        ///                 if (result.Error != null)
        ///                     Console.WriteLine(result.Error.ToString());
        ///                 Console.WriteLine("press enter to continue...");
        ///                 Console.ReadLine();
        ///             }
        ///         }
        ///                     
        ///         catch(Exception ex)
        ///         {
        ///             Console.WriteLine("An unhandled exception was thrown : " + ex.Message);
        ///         }
        /// </code>
        ///     <code lang="VB" title="VB.NET">
        /// Dim whoIs As WhoIs = New WhoIs()
        ///  
        /// Dim servers As ServerCollection = New ServerCollection()
        ///  
        ///     Dim server1 As Server = New Server()
        ///     server1.Host = "whois.networksolutions.com"
        ///     server1.Port = 43
        ///     server1.Domain = ".com"
        ///     server1.NoMatch = "no match"
        ///     servers.Add(server1)
        ///  
        ///     Dim server2 As Server = 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.GlobalQueryAsync(servers, "activeup", New AsyncCallback(AddressOf MyCallbackGlobalWhoIs))
        ///  
        ///         Public Sub MyCallbackGlobalWhoIs(ByVal state As IAsyncResult)
        ///  
        ///             Try
        ///  
        ///                 Dim results As ResultQueryCollection = whoIs.GlobalQueryAsyncResult(state)
        ///  
        ///                 Dim result As ResultQuery
        ///                 For Each result In results
        ///                     Console.WriteLine(result.Result)
        ///                     Console.WriteLine(result.ServerUsed.Host)
        ///                     If (Not (result.Error Is Nothing)) Then
        ///                         Console.WriteLine(result.Error.ToString())
        ///                     End If
        ///                     Console.WriteLine("press enter to continue...")
        ///                     Console.ReadLine()
        ///                 Next result
        ///  
        ///             Catch ex As Exception
        ///                  Console.WriteLine("An unhandled exception was thrown : " + ex.Message)
        ///  
        ///             End Try
        ///  
        ///     End Sub
        ///     </code>
        /// </example>
        /// <param name="servers">Whois servers list.</param>
        /// <param name="domainToQuery">Top level domain to query.</param>
        /// <param name="callBack">Call back function.</param>
        public IAsyncResult GlobalQueryAsync(ServerCollection servers, string domainToQuery, AsyncCallback callBack)
        {
            _globalQueryDelegate = new GlobalQueryDelegate(_GlobalQuery);
            return _globalQueryDelegate.BeginInvoke(servers,domainToQuery,callBack,null);

        }
Exemple #2
0
 /// <summary>
 ///  Query all the whois servers specifying the top level domain asynchronously.
 ///  </summary>
 /// <returns>IAsyncResult object that represents the result of the GlobalQueryAsync operation.</returns>
 /// <example>
 ///     <code lang="CS">
 /// WhoIs whoIs = new WhoIs();
 ///  
 ///     IAsyncResult state = whoIs.GlobalQueryAsync("activeup",new AsyncCallback(MyCallbackGlobalWhoIs));
 ///     
 ///     public static void MyCallbackGlobalWhoIs(IAsyncResult state)
 ///     {
 ///         try
 ///         {
 ///             ResultQueryCollection results = whoIs.GlobalQueryAsyncResult(state);
 ///  
 ///             foreach(ResultQuery result in results)
 ///             {
 ///                 Console.WriteLine(result.Result);
 ///                 Console.WriteLine(result.ServerUsed.Host);
 ///                 if (result.Error != null)
 ///                     Console.WriteLine(result.Error.ToString());
 ///                 Console.WriteLine("press enter to continue...");
 ///                 Console.ReadLine();
 ///             }
 ///         }
 ///                     
 ///         catch(Exception ex)
 ///         {
 ///             Console.WriteLine("An unhandled exception was thrown : " + ex.Message);
 ///         }
 ///     </code>
 ///     <code lang="VB" title="VB.NET">
 /// Dim whoIs As WhoIs = New WhoIs()
 ///  
 ///     Dim state As IAsyncResult = whoIs.GlobalQueryAsync("activeup", New AsyncCallback(AddressOf MyCallbackGlobalWhoIs))
 ///  
 ///         Public Sub MyCallbackGlobalWhoIs(ByVal state As IAsyncResult)
 ///  
 ///             Try
 ///  
 ///                 Dim results As ResultQueryCollection = whoIs.GlobalQueryAsyncResult(state)
 ///  
 ///                 Dim result As ResultQuery
 ///                 For Each result In results
 ///                     Console.WriteLine(result.Result)
 ///                     Console.WriteLine(result.ServerUsed.Host)
 ///                     If (Not (result.Error Is Nothing)) Then
 ///                         Console.WriteLine(result.Error.ToString())
 ///                     End If
 ///                     Console.WriteLine("press enter to continue...")
 ///                     Console.ReadLine()
 ///                 Next result
 ///  
 ///             Catch ex As Exception
 ///                  Console.WriteLine("An unhandled exception was thrown : " + ex.Message)
 ///  
 ///             End Try
 ///  
 ///     End Sub
 ///     </code>
 /// </example>
 /// <param name="domainToQuery">Top level domain to query.</param>
 /// <param name="callBack">Call back function.</param>
 public IAsyncResult GlobalQueryAsync(string domainToQuery, AsyncCallback callBack)
 {
     _globalQueryDelegate = new GlobalQueryDelegate(_GlobalQuery);
     return _globalQueryDelegate.BeginInvoke(null,domainToQuery,callBack,null);
 }