Returns the IP address and port number of the specified endpoint.
Assembly: System.Net (in System.Net.dll)
The 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.