KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: How to retrieve the local machines IP address using 4D command
PRODUCT: 4D | VERSION: 2004.2 | PLATFORM: Mac & Win
Published On: September 30, 2005

How to retrieve the local machines IP address using 4D command?

The easiest way is to use the command IT_MyTCPAddr. This command requires two type String parameters--a container to store the IP address of the users machine and a container to store the Subnet Mask in IP form of the users machine. The command returns an Error Code if one is encountered. For more inforamtion on this command go to https://www.4d.com/docs/CMU/CMU88914.HTM.
Below is an example of the command.

C_TEXT($ipAddress;$subnet)
C_LONGINT($errorCode)
$errorCode := IT_MyTCPAddr ($ipAddress; $subnet)
ALERT("IP address: " + $ipAddress + "\n" + "Subnet Mask: "+ $subnet)