ExternalAddress Property  

Return the external IP address for the local system.




The ExternalAddress property returns the IP address assigned to the router that connects the local host to the Internet. This is typically used by an application executing on a system in a local network that uses a router which performs Network Address Translation (NAT). In that network configuration, the ServerAddress property will only return the IP address for the local system on the LAN side of the network. The ExternalAddress property can be used to determine the IP address assigned to the router on the Internet side of the connection and can be particularly useful for servers running on a system behind a NAT router. Note that you should not assign the ServerAddress property to the value returned by the ExternalAddress property. If the server is running behind a NAT router, the router must be configured to forward incoming connections to the appropriate address on the LAN.

Using this property requires that you have an active connection to the Internet; checking the value of this property on a system that uses dial-up networking may cause the operating system to automatically connect to the Internet service provider. The control may be unable to determine the external IP address for the local host for a number of reasons, particularly if the system is behind a firewall or uses a proxy server that restricts access to external sites on the Internet. If the external address for the local host cannot be determined, the property will return an empty string.

If the control is able to obtain a valid external address for the local host, that address will be cached for sixty minutes. Because dial-up connections typically have different IP addresses assigned to them each time the system is connected to the Internet, it is recommended that this property only be used in conjunction with persistent broadband connections.

Data Type


See Also

ClientAddress Property, ServerAddress Property