Aracılığıyla paylaş


DnsEndPoint Constructor (String, Int32, AddressFamily)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

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.Net (in System.Net.dll)

Syntax

'Declaration
Public Sub New ( _
    host As String, _
    port As Integer, _
    addressFamily As AddressFamily _
)
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.

Exceptions

Exception Condition
ArgumentException

The host parameter contains an empty string

-or-

the addressFamily parameter is specified as Unknown.

ArgumentNullException

The host parameter is nulla null reference (Nothing in Visual Basic).

ArgumentOutOfRangeException

port is less than 0

-or-

port is greater than 0xffff.

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 is determined by the address family of the first IP address that resolves to the endpoint when used by a Socket.

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.