Log In    |    Knowledge Base    |    4D Home
Tech Tip: Obtaining the published or local IP address
PRODUCT: 4D Internet Commands | VERSION: | PLATFORM: Mac & Win
Published On: May 30, 2003

Versions: 6.8.1 and 2003

Here is a method that returns the IP address that is being used by the Web Server or the local IP address that the Web Server can use to publish.

$addr:=Get database parameter(IP Address to listen )
$a:=($addr >> 24) & 0x00FF
$b:=($addr >> 16) & 0x00FF
$c:=($addr >> 8) & 0x00FF
$d:=$addr & 0x00FF
If (($a=0) & ($b=0) & ($c=0) & ($d=0))
 $Error:=IT_MyTCPAddr ($ip_address;$subnet)
End if

Note: This method can return only one IP address. If the published IP address is set to "All" in the Database Properties (or Preferences for 4D 2003), the method will return the primary IP address of the machine as the function result. The only time that the secondary IP address will be returned is when it is set in the Database Properties (or Preferences for 4D 2003) to be the only published IP address.