See Also

Dns Class  | Dns Members

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Language

Visual Basic

C#

C++

C++/CLI

Show All

See Also Languages PowerTCP SSL Sockets for .NET

Server Property

Dart.PowerTCP.SslSockets Namespace > Dns Class : Server Property (Dns)

Gets or sets the first DNS server hostname or address in Servers.

[Visual Basic]
<ObsoleteAttribute("Dns.Server has been replaced with Dns.Servers. This property will now return the first item in Dns.Servers. Setting this property will set the first item in Dns.Servers. Setting this property to a null string will clear Dns.Servers.")> <BrowsableAttribute(False)> <DefaultValueAttribute()> Public Property Server As String
[C#]
[ObsoleteAttribute("Dns.Server has been replaced with Dns.Servers. This property will now return the first item in Dns.Servers. Setting this property will set the first item in Dns.Servers. Setting this property to a null string will clear Dns.Servers.")] [BrowsableAttribute(false)] [DefaultValueAttribute()] public string Server {get; set;}
[C++]
[ObsoleteAttribute("Dns.Server has been replaced with Dns.Servers. This property will now return the first item in Dns.Servers. Setting this property will set the first item in Dns.Servers. Setting this property to a null string will clear Dns.Servers.")] [BrowsableAttribute(false)] [DefaultValueAttribute()] public: __property string* get_Server(); public: __property void set_Server(    string* value );
[C++/CLI]
[ObsoleteAttribute("Dns.Server has been replaced with Dns.Servers. This property will now return the first item in Dns.Servers. Setting this property will set the first item in Dns.Servers. Setting this property to a null string will clear Dns.Servers.")] [BrowsableAttribute(false)] [DefaultValueAttribute()] public: property String^ Server {    String^ get();    void set (String^ value); }

Return Type

A string representing the first DNS server to use for resolving.

Remarks

With the addition of Dns.Servers to the interface, the behavior of this property has changed. It now represents the first item in the Dns.Servers collection.

Setting the property will either change the first item in Servers, or add a new item if the collection is empty.

Example

The following example demonstrates using the Dns control to resolve a domain name.

[Visual Basic] 

Private Sub ResolveTest()
   Dns1.Servers.Add("206.64.128.5") 'Adds this server to list of DNS servers
   Dns1.RotateServers = True 'Will always try next server in Dns1.Servers
   Dns1.Retries = 2 'On failures, try an additional two times
   Dns1.RetryInterval = 0 'Do not wait between retries
   Dim result As System.Net.IPHostEntry = Dns1.GetHost("www.dart.com")
   DisplayResult(result)
End Sub

Private Sub DisplayResult(ByVal result As System.Net.IPHostEntry)
   ' Display host name
   Debug.WriteLine("Host name: " + result.HostName)

   ' Display addresses, if any
   Dim add As System.Net.IPAddress
   For Each add In result.AddressList
      Debug.WriteLine("Address: " + add.ToString())
   Next

   ' Display aliases, if any
   Dim s As String
   For Each s In result.Aliases
      Debug.WriteLine("Aliases: " + s)
   Next
End Sub

[C#] 


private void ResolveTest()
{
  dns1.Servers.Add(
"206.64.128.5"); 'Adds this server to list of DNS servers
  
dns1.RotateServers = true; 'Will always try next server in Dns1.Servers
  
dns1.Retries = 2; 'On failures, try an additional two times
  
dns1.RetryInterval = 0; 'Do not wait between retries
  
System.Net.IPHostEntry result = dns1.GetHost("www.dart.com");
  DisplayResult(result);
}

private void DisplayResult(System.Net.IPHostEntry result)
{
  
// Display host name
  
Debug.WriteLine("Host name: " + result.HostName);

  
// Display addresses, if any
  
foreach(System.Net.IPAddress add in result.AddressList)
     Debug.WriteLine(
"Address: " + add.ToString());

  
// Display aliases, if any
  
foreach(string s in result.Aliases)
     Debug.WriteLine(
"Aliases: " + s);
}
                

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Dns Class  | Dns Members


Send comments on this topic.

Documentation version 1.1.2.0.

© 2008 Dart Communications.  All rights reserved.