Alaska Software Inc. - Terminal-server Client IP
Username: Password:
AuthorTopic: Terminal-server Client IP
Itai Ben-ArtziTerminal-server Client IP
on Sat, 14 Nov 2020 14:49:00 -0800
Hi,
Did anyone successfully retrieve the client IP address on a
terminal-server (RDP)?
How?

-Itai
Jose Antonio Diego KerejeRe: Terminal-server Client IP
on Sun, 15 Nov 2020 09:52:25 +0100
Hi,

see my answer in:

public.xbase++.gui
How to determine RemoteIP (IP Address) of a PC running remote desktop to a 
Server
September 23, 2014
Joao Grenhas

Regards. Diego
Itai Ben-ArtziRe: Terminal-server Client IP
on Sun, 15 Nov 2020 19:34:04 -0800
Thank you, Jose.
But where can I find WTSsessionInformation class?
Jose Antonio Diego KerejeRe: Terminal-server Client IP
on Mon, 16 Nov 2020 09:22:22 +0100
Hi,

Attached to my answer is the code. I can not find it?

I'll send it again anyway.

Regards. Diego


WTS.CH
WTS.PRG
Itai Ben-ArtziRe: Terminal-server Client IP
on Mon, 16 Nov 2020 23:22:45 -0800
Thank you, Diego!
Seems like it would work.
Where do I find OT4XB?
-Itai
Jose Antonio Diego KerejeRe: Terminal-server Client IP
on Tue, 17 Nov 2020 19:16:57 +0100
Itai Ben-ArtziRe: Terminal-server Client IP
on Tue, 17 Nov 2020 22:45:05 -0800
Thank you, Jose!
It is working great, but I was looking for the local-public IP of the
client, not the local-internal one.
Is there a way to get the local-public IP (to enable http call back to
the client's network)?
Many thanks,
-Itai
Carlos A Beling Re: Terminal-server Client IP
on Wed, 18 Nov 2020 10:08:21 -0300
Hi Itai:
good day.
Please see if this is what you are looking for.

Fraternally
Beling

On 18/11/2020 03:45, Itai Ben-Artzi wrote:
> Thank you, Jose!
> It is working great, but I was looking for the local-public IP of the
> client, not the local-internal one.
> Is there a way to get the local-public IP (to enable http call back to
> the client's network)?
> Many thanks,
> -Itai
>


Ip.zip
Itai Ben-ArtziRe: Terminal-server Client IP
on Wed, 18 Nov 2020 11:59:10 -0800
Thank you, Carlos, but this PRG is not what I am looking for.
I am trying to get the public IP of an RDP client (not 192.168.x.x).
It seems the solution is somewhere in the API Wtsapi32.dll, but I
could not find it.

(BTW IP.PRF requires several *.CH files which I do not have).
I will try to open a new thread for this.
Again, many thanks for sharing the IP.PRG.
-Itai
Carlos A Beling Re: Terminal-server Client IP
on Wed, 18 Nov 2020 17:35:13 -0300
NI Itai:
Good evening.
Would it to be his?
https://docs.microsoft.com/en-us/windows/win32/termserv/terminal-services-api-functions

Fraternally
Beling

On 18/11/2020 16:59, Itai Ben-Artzi wrote:
> Thank you, Carlos, but this PRG is not what I am looking for.
> I am trying to get the public IP of an RDP client (not 192.168.x.x).
> It seems the solution is somewhere in the API Wtsapi32.dll, but I
> could not find it.
> 
> (BTW IP.PRF requires several *.CH files which I do not have).
> I will try to open a new thread for this.
> Again, many thanks for sharing the IP.PRG.
> -Itai
>
Itai Ben-ArtziRe: Terminal-server Client IP
on Wed, 18 Nov 2020 21:11:12 -0800
Carlos,
None of the functions in that link can be used to show the
local-public IP.
I know the server has it because netstat is showing it (along with all
other connections), but I could not find the API that exposes that IP.

-Itai
Carlos A Beling Re: Terminal-server Client IP
on Thu, 19 Nov 2020 16:49:31 -0300
Hi Itai:
my last try to get the text created below (using RunShell() or other):
ping.exe -4 + HostName > RemoteIP.txt

Fraternally
Beling

On 19/11/2020 02:11, Itai Ben-Artzi wrote:
> Carlos,
> None of the functions in that link can be used to show the
> local-public IP.
> I know the server has it because netstat is showing it (along with all
> other connections), but I could not find the API that exposes that IP.
> 
> -Itai
>
Itai Ben-ArtziRe: Terminal-server Client IP
on Thu, 19 Nov 2020 12:31:30 -0800
Beling,
I do not understand this.
Ping requires a valid IP or URL.
Carlos A Beling Re: Terminal-server Client IP
on Thu, 19 Nov 2020 19:59:07 -0300
Hi Itai
I attached what I am using.
I do not remember how I got it.
Please see it.

Fraternally
Beling




On 19/11/2020 17:31, Itai Ben-Artzi wrote:
> Beling,
> I do not understand this.
> Ping requires a valid IP or URL.
>


GetIp.prg
Itai Ben-ArtziRe: Terminal-server Client IP
on Thu, 19 Nov 2020 16:11:25 -0800
Beling,
Does it show the remote-client IP or the local server IP?
Could you please post CabDefs.ch as well?
Thanks,
-Itai
Carlos A Beling Re: Terminal-server Client IP
on Fri, 20 Nov 2020 13:19:13 -0300
Hi Itai:
good day.
I do not understand many things about internet communication, but I got 
somewhere things contained in this attach and I hope that this is what 
you are looking for. If it is not, excuse me to make you loose your time.
In time: excuse the bad code that I wrote and, if you need, I have the 
complete headers files used (they are big) and can seek for other things 
that you may need among that things that I had collected.

Fraternally
Beling

On 19/11/2020 21:11, Itai Ben-Artzi wrote:
> Beling,
> Does it show the remote-client IP or the local server IP?
> Could you please post CabDefs.ch as well?
> Thanks,
> -Itai
>


IP.zip
Itai Ben-ArtziRe: Terminal-server Client IP
on Fri, 20 Nov 2020 10:31:52 -0800
Thank you Beling.
This program shows the public IP of the computer on which it is
running.
In the case of terminal-server, the program runs on a server, but we
need to know the public-IP of the client connected to that server.
I'll post a solution when I find it at the upper thread.

Again, thank you for your help.
-Itai
Carlos A Beling Re: Terminal-server Client IP
on Fri, 20 Nov 2020 19:17:25 -0300
Hi Itai:
I thought that the comment below could to have a clue for the solution 
of the problem:

      You can get the external IP address of your computer only from 
the outside
          world. There is no way to determine if it is a static or 
dynamic IP address,
          though.
      There are several services that will tell you what your IP 
address but they don't
            always work and change over time.
      If they fail you can to make a Google search like "what is my IP"
      The services may return a html where the IP is inside and you 
need to parse it for to get the IP.


Fraternally
Beling

On 20/11/2020 15:31, Itai Ben-Artzi wrote:
> Thank you Beling.
> This program shows the public IP of the computer on which it is
> running.
> In the case of terminal-server, the program runs on a server, but we
> need to know the public-IP of the client connected to that server.
> I'll post a solution when I find it at the upper thread.
> 
> Again, thank you for your help.
> -Itai
>
Itai Ben-ArtziRe: Terminal-server Client IP
on Fri, 20 Nov 2020 14:35:46 -0800
Beling,
The terminal-server is at the "outside world".  Each client's
connection is set on a specific outgoing port linked to the client's
public IP.  That connection can be viewed via NatStat.  But it seems
that Microsoft did not [yet] develop an API that exposes the
connection of each session.  Thus, my search for such API is
[currently] unsuccessful.  I should resolve this problem in a
different way.

-Itai