Function Reference


_GetIP

Get public IP address of a network/computer

#include <Inet.au3>
_GetIP ( )

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. The sites used are https://www.ipify.org, http://checkip.dyndns.org, http://www.myexternalip.com/raw and http://www.bot.whatismyipaddress.com.

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 $sPublicIP = _GetIP()
MsgBox($MB_SYSTEMMODAL, "", "Your external IP address is: " & $sPublicIP)