Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DnsEndPoint Constructor (String, Int32, AddressFamily)

Initializes a new instance of the DnsEndPoint class with the host name or string representation of an IP address, a port number, and an address family.

Namespace:  System.Net
Assembly:  System (in System.dll)
public DnsEndPoint(
	string host,
	int port,
	AddressFamily addressFamily
)

Parameters

host
Type: System.String

The host name or a string representation of the IP address.

port
Type: System.Int32

The port number associated with the address, or 0 to specify any available port. port is in host order.

addressFamily
Type: System.Net.Sockets.AddressFamily

One of the AddressFamily values.

ExceptionCondition
ArgumentException

The host parameter contains an empty string.

-or-

addressFamily is Unknown.

ArgumentNullException

The host parameter is a null.

ArgumentOutOfRangeException

port is less than MinPort.

-or-

port is greater than MaxPort.

The DnsEndPoint(String, Int32, AddressFamily) constructor can be used to initialize a DnsEndPoint class using either a host name or a string that represents an IP address, a port, and an address family.

When using the constructor with a host name rather than a string representation of an IP address, the address family restricts DNS resolution to prefer addresses of the specified address family value. When using the constructor with the address family specified as Unknown, the address family of the DnsEndPoint will remain Unknown even after use. The AddressFamily property of any Socket that is created by calls to the ConnectAsync method will be the address family of the first address to which a connection can be successfully established (not necessarily the first address to be resolved).

.NET Framework

Supported in: 4.5.1, 4.5, 4

.NET Framework Client Profile

Supported in: 4

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.