Uredi

Deli z drugimi prek


DnsEndPoint Constructors

Definition

Initializes a new instance of the DnsEndPoint class.

Overloads

DnsEndPoint(String, Int32)

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

DnsEndPoint(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.

DnsEndPoint(String, Int32)

Source:
DnsEndPoint.cs
Source:
DnsEndPoint.cs
Source:
DnsEndPoint.cs

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

public:
 DnsEndPoint(System::String ^ host, int port);
public DnsEndPoint (string host, int port);
new System.Net.DnsEndPoint : string * int -> System.Net.DnsEndPoint
Public Sub New (host As String, port As Integer)

Parameters

host
String

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

port
Int32

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

Exceptions

The host parameter contains an empty string.

The host parameter is a null.

port is less than MinPort.

-or-

port is greater than MaxPort.

Remarks

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

When using this constructor with a host name rather than a string representation of an IP address, 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).

Applies to

DnsEndPoint(String, Int32, AddressFamily)

Source:
DnsEndPoint.cs
Source:
DnsEndPoint.cs
Source:
DnsEndPoint.cs

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.

public:
 DnsEndPoint(System::String ^ host, int port, System::Net::Sockets::AddressFamily addressFamily);
public DnsEndPoint (string host, int port, System.Net.Sockets.AddressFamily addressFamily);
new System.Net.DnsEndPoint : string * int * System.Net.Sockets.AddressFamily -> System.Net.DnsEndPoint
Public Sub New (host As String, port As Integer, addressFamily As AddressFamily)

Parameters

host
String

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

port
Int32

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

addressFamily
AddressFamily

One of the AddressFamily values.

Exceptions

The host parameter contains an empty string.

-or-

addressFamily is Unknown.

The host parameter is a null.

port is less than MinPort.

-or-

port is greater than MaxPort.

Remarks

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).

Applies to