# Function Reference

# _GetIP

Get public IP address of a network/computer

#include <Inet.au3>
_GetIP ( [$vIPType = Default] )

## Parameters

$vIPType | [optional] Specifies the IP discovery web sites: $INET_IPV4 ("V4") - (Default) $INET_IPV6 ("V6")

## Return Value

Success: | the public IP address (see remarks).
Failure: | -1 and sets the @error to non-zero.

## Remarks

This only returns the public IP address of a computer or network (i.e. the public IP on the WAN link of your NAT router).
The address is determined by accessing an external IP discovery web site:
for IPV4 are https://www.ipify.org, http://checkip.dyndns.org, http://www.myexternalip.com/raw, http://www.networksecuritytoolkit.org/nst/tools/ip.php and http://ip.eprci.net/text.
for IPV6 are http://icanhazip.com and http://www.trackip.net/ip.
To reduce overloading the IP discovery sites a 5 minute timer is used between each function call. If _GetIP() is used during this 5 minute period, the previous IP is returned and @extended set to 1.

## Example

    #include <Inet.au3>
    #include <MsgBoxConstants.au3>

    Local $sPublicIPV4, $sPublicIPV6
    ;~ _GetIP_() ; to force second _GetIP() to avoid server connection
    $sPublicIPV4 = _GetIP()

    ;~  _GetIP_("V6")) ; to force second _GetIP("V6") to avoid server connection
    $sPublicIPV6 = _GetIP($INET_IPV6)

    MsgBox($MB_SYSTEMMODAL, "_GetIP()", "Your external IP address is:" & @CRLF & @CRLF & "Public IPV4 = " & $sPublicIPV4 & @CRLF & "Public IPV6 = " & $sPublicIPV6)