Hi Juray,
the second line provokes here: warning VN3030: GetHostByName is obsoleted for this type, please use GetHostEntry instead. http://go.microsoft.com/fwlink/?linkid=14202
I tried to use this, and it works , only difference ist, for "ByName" i get an IP4, with "Entry" an IP 6 address back.
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
Robert,
ups - yes, silly me hasn't noticed - this test app was really old
Changed it to X#/VO, swapped references, added VOInternetClasses.dll, compiles fine, albeit with the corresponding XS0618 warning - and it fails at runtime, because it can't find the latter (V 2.6.0.0), even when it is copied into bin.
Why?
Regards
Karl
(on Win8.1/64, Xide32 2.20, X#2.20.0.3)
FUNCTION XGetIPAddress( ) AS STRING STRICT
LOCAL cHostName := System.Net.Dns.gethostname() AS STRING
LOCAL cIP := System.Net.Dns.gethostbyname(cHostName).AddressList[1].ToString() AS STRING
RETURN cIP // returns 192.168 ....
Thanks, Juraj. And Wolfgang and Fabrice and Robert.
That AddressList member is an array, which means it could return several IP addresses. I tested it here and it returned only one. But perhaps a more complete solution would be to loop AddressList and potentially return several IPs.
FFF wrote:Robert,
ups - yes, silly me hasn't noticed - this test app was really old
Changed it to X#/VO, swapped references, added VOInternetClasses.dll, compiles fine, albeit with the corresponding XS0618 warning - and it fails at runtime, because it can't find the latter (V 2.6.0.0), even when it is copied into bin.
Why?
This dll depends on VOWin32APILibrary.dll and XSHarp.code.dll and XSharp.RT.dll, have you included those as well?