NextIPAddress()

Syntax

Result = NextIPAddress()
Description
Returns the next IP address of the local machine. ExamineIPAddresses() must be called before this command.

Parameters

None.

Return value

Returns the next IP address in numerical form. If the result is 0 then there are no more IP addresses to be examined. If ExamineIPAddresses() is called with the #PB_Network_IPv6 format, the returned IP needs to freed with FreeIP() after use.

Example: IPv4

  InitNetwork()
  If ExamineIPAddresses()
    Repeat
      IP = NextIPAddress()
      If IP
        Debug "IPv4: " + IPString(IP) 
      EndIf
    Until IP = 0
  EndIf

Example: IPv6

  InitNetwork()
  If ExamineIPAddresses(#PB_Network_IPv6)
    Repeat
      IP = NextIPAddress()
      If IP
        Debug "IPv6: " + IPString(IP, #PB_Network_IPv6) 
        FreeIP(IP)                                     
      EndIf
    Until IP = 0
  EndIf

See Also

ExamineIPAddresses(), IPString()

Supported OS

All

<- NetworkServerEvent() - Network Index - OpenNetworkConnection() ->