Tech Tip: How to get the server IP address from a client machine
PRODUCT: 4D | VERSION: 11.6 | PLATFORM: Mac & Win
Published On: April 2, 2010
An easy way to get the server's IP address from the client machine is to use the IT_MyTCPAddr command from the 4D Internet Commands plugin. To implement this:
- Install the 4D Internet Commands.bundle in the database Plugins folder.
- Create a method with the Execute on server property checked on. The method below named Util_IpAddress will work for this:
`--- Method Util_IpAddress
`This method has Execute on server property checked on
`
C_TEXT($ipAddress;$subnet)
C_TEXT($0)
IT_MyTCPAddr ($ipAddress;$subnet)
$0:=$ipAddress
`---End Util_IpAddress - Create another method that calls Util_IpAddress from the client. The method below named getServer_IpAddress does this:
`---Method getServer_IpAddress
`
C_TEXT($serverIP)
$serverIP:= Util_IpAddress
`---End getServer_IpAddress - Execute getServer_IpAddress to retrieve the IP.