IPEndPoint.ToString Method
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Returns the IP address and port number of the specified endpoint.
Namespace: System.Net
Assembly: System.Net (in System.Net.dll)
Syntax
'Declaration
Public Overrides Function ToString As String
public override string ToString()
Return Value
Type: System.String
A string containing the IP address and the port number of the specified endpoint.
Remarks
The ToString method returns a string that contains IP address and the port number. For an IPv4 IP endpoint, this is the IPv4 address in dotted-decimal notation followed by a colon and the port (for example, 192.168.1.2:80). For an IPv6 IP endpoint, this is the IPv6 address in colon-hexadecimal notation followed by an optional scope id and the port.
The basic string representation of the IPv6 address consists of 8 hexadecimal numbers separated by colons. A string of consecutive zero hexadecimal numbers is replaced with a double colon. There can only be one double colon in the string representation of the IPv6 address.
If a scope ID is provided, the string representation of the scope ID is separated from the string representation of the IPv6 address by a percent character ('%'). If a port number is provided, the string representation of the IPv6 address and the scope ID are surrounded by square braces (a leading '[' character followed by the IPv6 address followed by a '% character followed by the scope ID with a trailing ']' character). The port number is represented as a colon following the right square brace character followed by the string representation of the port number in decimal.
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.