getipv4addr

Retrieves local IPv4 address(es). (version 4.78 or later)

getipv4addr <string array> <intvar>

Parameters

String array <string array>
IP addresses are stored in the string array.
Integer variable <intvar>
IP address counts. If the IP address is none, it is set to 0.

Return Value

System variable <result>
When the IP addresses are retrieved, it is set to 1.
When the IP address counts is bigger than the <string array> entries, it is set to 0.
When the IP address can not retrieve, it is set to -1.

Example

ipaddr_size = 10
strdim ipaddr ipaddr_size

getipv4addr ipaddr num
if result = -1 then
    messagebox 'Error' 'IPv4 address'
elseif result = 0 then
    N = ipaddr_size - 1
    for i 0 N
        messagebox ipaddr[i] "IPv4 address"
    next
    N = num - ipaddr_size
    sprintf2 str "And %d address(es)." N
    messagebox str "IPv4 address"
else
    N = num - 1
    for i 0 N
        messagebox ipaddr[i] "IPv4 address"
    next
endif

See also