ActiveSession.GET(SERVICEINSTANCEID, SESSIONID);
IPAddresses:= IPAddresses.List;
IPAddresses.AddRange(Dns.GetHostAddresses(ActiveSession."Client Computer Name"));
FOR i := 0 TO IPAddresses.Count - 1 DO BEGIN
MESSAGE('%1', IPAddresses.Item(i));
END;
Where variables:
P.S: the client machine may have more than one IP address.
Possible...well maybe technically. But you would have to get the client session (RDP session) to ask Windows (netstat or something more modern?) to give you the remote ip address. Sounds like adding a lot of error-prone complexity to me.
Few Local Machines are using RDP for accessing the NAV DB, I need to know their the Local IP address.
Is it possible ?
Hi navuser1,
1- you should give feedback if the suggested solutions worked or not.
2- it is not too difficult to say "thank you" to people who are trying to help you.
3- you're asking a second question that is different from the first one.
In another note, as suggested by EvR, you may use netstat and try to find the IP address through TCP port 3389 if default. Otherwise you should look for port value in registry key: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp]
Another suggestion is to use the "Remote Desktop Services API reference".
The topic is dated, but if memory serves, you should opt for RunOnClient 😅
My memory of .NET specifics is fuzzy at the moment. RunOnClient likely won't function on a web client due to .NET restrictions.
Could you try it out and report back? 😉
Answers
http://stackoverflow.com/questions/6803073/get-local-ip-address
You can try this code
ActiveSession.GET(SERVICEINSTANCEID, SESSIONID);
IPAddresses:= IPAddresses.List;
IPAddresses.AddRange(Dns.GetHostAddresses(ActiveSession."Client Computer Name"));
FOR i := 0 TO IPAddresses.Count - 1 DO BEGIN
MESSAGE('%1', IPAddresses.Item(i));
END;
Where variables:
P.S: the client machine may have more than one IP address.
Is it possible ?
Hi navuser1,
1- you should give feedback if the suggested solutions worked or not.
2- it is not too difficult to say "thank you" to people who are trying to help you.
3- you're asking a second question that is different from the first one.
In another note, as suggested by EvR, you may use netstat and try to find the IP address through TCP port 3389 if default. Otherwise you should look for port value in registry key: [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp]
Another suggestion is to use the "Remote Desktop Services API reference".
I am unable to create a variable of DotNet type for Dns.
I didn't find Dns class there.
Please help me......
And you can download the object "COD92600_Get Local IP.txt"
P.S: delete ".jpg" to get the correct object extension.
In order to get client's Ip address, these dotnet variables should be tagged as RunOnClient as Yes, right?
Second Question: Is it possible to use this for web client? (business central on prem 14)
The topic is dated, but if memory serves, you should opt for RunOnClient 😅
My memory of .NET specifics is fuzzy at the moment. RunOnClient likely won't function on a web client due to .NET restrictions.
Could you try it out and report back? 😉
Thanks for the response, I tried unfortunately it doesn't work on web client, it produces this error: ( got via debug)