/// <summary> /// Query a whois server specifying the specified Server object and domain to query asynchronously. /// </summary> /// <param name="server">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 QueryAsync operation.</returns> /// <example> /// <code> /// [C#] /// /// WhoIs whoIs = new WhoIs(); /// /// Server server = new Server(); /// server.Host = "whois.networksolutions.com"; /// server.Port = 43; /// server.Domain = ".com"; /// /// IAsyncResult state = whoIs.QueryAsync(server,"activeup.com",new AsyncCallback(MyCallbackWhoIs)); /// /// public void MyCallbackWhoIs(IAsyncResult state) /// { /// try /// { /// string result = whoIs.QueryAsyncResult(state); /// Console.WriteLine(result); /// } /// /// 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 server As New Server() /// server.Host = "whois.networksolutions.com" /// server.Port = 43 /// server.Domain = ".com" /// Dim state As IAsyncResult = whoIs.QueryAsync(server, New AsyncCallback(AddressOf MyCallbackWhoIs)) /// /// Public Sub MyCallbackWhoIs(ByVal state As IAsyncResult) /// /// Try /// /// Dim result As String = whoIs.QueryAsyncResult(state) /// Console.WriteLine(result) /// /// 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 QueryAsync(Server server, string domainToQuery,AsyncCallback callBack) { ServerCollection servers = new ServerCollection(); servers.Add(server); _queryDelegate = new QueryDelegate(_Query); return _queryDelegate.BeginInvoke(servers,domainToQuery,false,callBack,null); }
/// <summary> /// Query a whois server specifying the specified Server object and domain to query. /// </summary> /// <param name="server">Whois server.</param> /// <param name="domainToQuery">Domain to query.</param> /// <returns>Result of the whois server.</returns> /// <example> /// <code> /// [C#] /// /// try /// { /// Server server = new Server(); /// server.Host = "whois.networksolutions.com"; /// server.Port = 43; /// server.Domain = ".com"; /// /// WhoIs whoIs = new WhoIs(); /// string result = whoIs.Query(server,"activeup.com"); /// Console.WriteLine(result); /// } /// /// catch(WhoisException we) /// { /// Console.WriteLine("WhoisException : " + we.Message); /// } /// /// catch(Exception ex) /// { /// Console.WriteLine("An unhandled exception was thrown : " + ex.Message); /// } /// /// [VB.NET] /// /// Try /// /// Dim server As New Server() /// server.Host = "whois.networksolutions.com" /// server.Port = 43 /// server.Domain = ".com" /// /// Dim whoIs As New WhoIs() /// Dim result As String = whoIs.Query("whois.networksolutions.com",43,"activeup.com") /// Console.WriteLine(result) /// /// Catch we as WhoisException /// Console.WriteLine("WhoisException : " + we.Message) /// /// Catch ex As Exception /// Console.WriteLine("An unhandled exception was thrown : " + ex.Message) /// /// End Try /// </code> /// </example> public string Query(Server server, string domainToQuery) { ServerCollection servers = new ServerCollection(); servers.Add(server); return _Query(servers,domainToQuery,false); }
/// <summary> /// Query a whois server specifying the specified host, port and domain to query. /// </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> /// <returns>Result of the whois server.</returns> /// <example> /// <code> /// [C#] /// /// try /// { /// WhoIs whoIs = new WhoIs(); /// string result = whoIs.Query("whois.networksolutions.com",43,"activeup.com"); /// Console.WriteLine(result); /// } /// /// catch(WhoisException we) /// { /// Console.WriteLine("WhoisException : " + we.Message); /// } /// /// catch(Exception ex) /// { /// Console.WriteLine("An unhandled exception was thrown : " + ex.Message); /// } /// /// [VB.NET] /// /// Try /// /// Dim whoIs As New WhoIs() /// Dim result As String = whoIs.Query("whois.networksolutions.com",43,"activeup.com") /// Console.WriteLine(result) /// /// Catch we as WhoisException /// Console.WriteLine("WhoisException : " + we.Message) /// /// Catch ex As Exception /// Console.WriteLine("An unhandled exception was thrown : " + ex.Message) /// /// End Try /// </code> /// </example> public string Query(string host, int port, string domainToQuery) { ServerCollection servers = new ServerCollection(); servers.Add(new Server(host,port)); return _Query(servers,domainToQuery,false); }
/// <summary> /// Checks to see if a domain is available for registration asynchronously sing the specified Server object and domain to query. /// </summary> /// <param name="server">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#] /// /// Server server = new Server(); /// server.Host = "whois.networksolutions.com"; /// server.Port = 43; /// server.Domain = ".com"; /// server.NoMatch = "no match"; /// /// WhoIs whoIs = new WhoIs(); /// IAsyncResult state = whoIs.IsAvailableAsync(server,"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 server As New Server() /// server.Host = "whois.networksolutions.com" /// server.Port = 43 /// server.Domain = ".com" /// server.NoMatch = "no match" /// /// Dim state As IAsyncResult = whoIs.IsAvailableAsync(server,"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(Server server, string domainToQuery,AsyncCallback callBack) { ServerCollection servers = new ServerCollection(); servers.Add(server); _isAvailableDelegate = new IsAvailableDelegate(_IsAvailable); return _isAvailableDelegate.BeginInvoke(servers,domainToQuery,callBack,null); }
/// <summary> /// Checks if a domain is available for registration specifying the specified Server object and domain to query. /// </summary> /// <param name="server">Whois server.</param> /// <param name="domainToQuery">Domain to query.</param> /// <returns>True if the domain is available for registration. False if the domain name is not available for registration and is already taken by someone else.</returns> /// <example> /// <code> /// [C#] /// /// try /// { /// Server server = new Server(); /// server.Host = ""; /// server.Port = 43; /// server.Domain = ".com"; /// server.NoMatch = "no match"; /// /// WhoIs whoIs = new WhoIs(); /// bool result = whoIs.IsAvailable(server,"activeup.com"); /// 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] /// /// Try /// /// Dim server As New Server() /// server.Host = "whois.networksolutions.com" /// server.Port = 43 /// server.Domain = ".com" /// server.NoMatch = "no match" /// /// Dim whoIs As New WhoIs() /// Dim result As Boolean = whoIs.IsAvailable(server, "activeup.com") /// 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 /// </code> /// </example> public bool IsAvailable(Server server, string domainToQuery) { ServerCollection servers = new ServerCollection(); servers.Add(server); return _IsAvailable(servers,domainToQuery); }
/// <summary> /// Checks if a domain is available for registration specifying the specified host, port, domain to query and the string indicates the domain doesn't exist. /// </summary> /// <param name="host">Host or IP address of the whois server.</param> /// <param name="port">Port of the whois server.</param> /// <param name="domainToQuery">Domain to query.</param> /// <param name="noMatch">String indicates the domain doesn't exist</param> /// <returns>True if the domain is available for registration. False if the domain name is not available for registration and is already taken by someone else.</returns> /// <example> /// <code> /// [C#] /// /// try /// { /// WhoIs whoIs = new WhoIs(); /// bool result = whoIs.IsAvailable("whois.networksolutions.com",43,"activeup.com","no match"); /// /// 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] /// /// Try /// /// Dim whoIs As New WhoIs() /// Dim result As Boolean = whoIs.IsAvailable("whois.networksolutions.com",43, "activeup.com", "no match") /// 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 /// </code> /// </example> public bool IsAvailable(string host, int port, string domainToQuery, string noMatch) { ServerCollection servers = new ServerCollection(); servers.Add(new Server(host,port,"",noMatch)); return _IsAvailable(servers,domainToQuery); }