Hello, is there way I can get ip adress of client computer that is running uniface form application via proc/function statement? Thanks for hints dammie
There are some tiny JAVA programs documented: https://beginnersbook.com/2014/07/java-program-to-get-ip-address/ export it as "junnable JAR", and you can start it with: spawn "#javaw -jar my_jar_file" Another option inside Uniface would be (with a temp creation of the <$componentname>.bat): entry do_launch params string p_formname : out endparams spawn "#<$componentname>.bat" ; ipconfig > TEST1.out fileload "<$componentname>.out", p_formname end ; do_launch HIH, Uli
$settings accesses registry settings --> HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces There are two or three keys here - you'll probably have to search each for 'DhcpServer' - if that sub key is present, the 'real' IP address for the PC will be in 'DhcpIPAddress'. Good luck. Knut
Hi Knut, a very nice solution without any implementations outside the uniface world. Think I should read a little more about the contents of the Windows Registy. Greetings from a very cold Frankfurt/Main morning (5° C), Uli
My approach would be: 1. use ipconfig (in DOS box) to obtain your ip address (in my case 172.16.38.124) 2. Search the HKEY_LOCAL_MACHINE in regedit for that value to come up with the keys that Knut mentions already from the top of his mind. 3. Read the Uniface documentation on how to craft something, using $setting. More background on the use of $setting to obtain registry values (click-able link): Uniface Reference > Proc: Functions > $setting > Addressing Registry Keys with $setting (Does anybody know how stable these registry keys are; do they change over time?)
Author: Arjen van Vliet (arjen.van.vliet@uniface.com)
Arjen van Vliet said ... 1. use ipconfig (in DOS box) to obtain your ip address (in my case 172.16.38.124) ...
Is it that simple? Not really in my experience... The simple case scenario (IPv4): one network card = one IP and one gateway The worst case scenario (IPv4 or IPv6): +network cards = +IPs and +one or more gateways to deal with [it is becoming the normal scenario with Ethernet + WiFi + Bluetooth + VPN(s) + ...] After installing "Unix Utilities" (GnuWin32) into your Windows machine the command could be: C:\> ipconfig | grep IPv4 | awk "{print $NF}" This command could report one or more IP in the link-local range 169.254.0.0/16; these IP(s) could simply be discarded. The same approach should work for IPv6, remembering to discard those in the link-local range FE80::/10. C:\> ipconfig | grep IPv6 | awk "{print $NF}" A refined approach for IPv4 should consider in parallel with each IP(s) the default gateway associated to with command: C:\> ipconfig | grep Gateway | awk "{print $NF}" Only network card(s) associated with a real gateway are able to send net traffic to the outside world. Gateways AFAIK are automatic on IPv6. Which part of the "world" sits behind each gateway in a complex network, it could be difficult to recognize... Some of these rules should be applied also if Windows registry is inpected using $setting(). Hope it helps... Gianni
7 Comments
Local Administrator
Author: ulrich-merkel (ulrichmerkel@web.de)
Local Administrator
Is there any other way? -- for some security reason os command implementaion is not available for user of application...
Author: dammie (dammie@seznam.cz)
Local Administrator
There are some tiny JAVA programs documented: https://beginnersbook.com/2014/07/java-program-to-get-ip-address/ export it as "junnable JAR", and you can start it with: spawn "#javaw -jar my_jar_file" Another option inside Uniface would be (with a temp creation of the <$componentname>.bat): entry do_launch params string p_formname : out endparams spawn "#<$componentname>.bat" ; ipconfig > TEST1.out fileload "<$componentname>.out", p_formname end ; do_launch HIH, Uli
Author: ulrich-merkel (ulrichmerkel@web.de)
Local Administrator
$settings accesses registry settings --> HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces There are two or three keys here - you'll probably have to search each for 'DhcpServer' - if that sub key is present, the 'real' IP address for the PC will be in 'DhcpIPAddress'. Good luck. Knut
Author: Knut (knut.dybendahl@gmail.com)
Local Administrator
Hi Knut, a very nice solution without any implementations outside the uniface world. Think I should read a little more about the contents of the Windows Registy. Greetings from a very cold Frankfurt/Main morning (5° C), Uli
Author: ulrich-merkel (ulrichmerkel@web.de)
Local Administrator
My approach would be: 1. use ipconfig (in DOS box) to obtain your ip address (in my case 172.16.38.124) 2. Search the HKEY_LOCAL_MACHINE in regedit for that value to come up with the keys that Knut mentions already from the top of his mind. 3. Read the Uniface documentation on how to craft something, using $setting. More background on the use of $setting to obtain registry values (click-able link): Uniface Reference > Proc: Functions > $setting > Addressing Registry Keys with $setting (Does anybody know how stable these registry keys are; do they change over time?)
Author: Arjen van Vliet (arjen.van.vliet@uniface.com)
Local Administrator
Is it that simple? Not really in my experience... The simple case scenario (IPv4): one network card = one IP and one gateway The worst case scenario (IPv4 or IPv6): +network cards = +IPs and +one or more gateways to deal with [it is becoming the normal scenario with Ethernet + WiFi + Bluetooth + VPN(s) + ...] After installing "Unix Utilities" (GnuWin32) into your Windows machine the command could be: C:\> ipconfig | grep IPv4 | awk "{print $NF}" This command could report one or more IP in the link-local range 169.254.0.0/16; these IP(s) could simply be discarded. The same approach should work for IPv6, remembering to discard those in the link-local range FE80::/10. C:\> ipconfig | grep IPv6 | awk "{print $NF}" A refined approach for IPv4 should consider in parallel with each IP(s) the default gateway associated to with command: C:\> ipconfig | grep Gateway | awk "{print $NF}" Only network card(s) associated with a real gateway are able to send net traffic to the outside world. Gateways AFAIK are automatic on IPv6. Which part of the "world" sits behind each gateway in a complex network, it could be difficult to recognize... Some of these rules should be applied also if Windows registry is inpected using $setting(). Hope it helps... Gianni
Author: gianni (gianni.sandigliano@unifacesolutions.com)