Logging Client IPAddress/Hostname

Questions, answers, tips and ideas on Servoy Client

Logging Client IPAddress/Hostname

Postby briese-it » Tue Apr 18, 2017 8:23 am

Hello,
how can I get the client IPAddress/Hostname etc?

application.getIPAddress returns IP serverside
application.getHostName returns Servername
application.getOSName returns Server-OS

Additionally I tried the usermanager plugin with the same results:

var vClient = plugins.UserManager.Client();
vClient.ipAddress returns Server-IP
vClient.hostAddress returns Server-IP
vClient.hostName returns Servername;
vClient.osName returns Server-OS

Any ideas?
Michael Harms
Briese Schiffahrts GmbH & Co.KG, Germany
- Servoy 8.1.4 Running on Windows 2008R2 DataCenter - MSSQL2008
User avatar
briese-it
 
Posts: 122
Joined: Mon Jun 20, 2011 1:50 pm
Location: Leer, Germany

Re: Logging Client IPAddress/Hostname

Postby patrick » Tue Apr 18, 2017 9:28 am

I guess this is webclient? Then it's obvious, because your client runs on the server, so all calls to the Java virtual machine are made to the one of the server. To figure out these things in a client browser, you need to google a bit. External IP addresses can be resolved using external scripts and the navigator object offers quite some properties to narrow down operating system etc.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3621
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: Logging Client IPAddress/Hostname

Postby briese-it » Tue Apr 18, 2017 9:48 am

Yes it's webclient.
Client informations like IP and timeZone are visible on the Servoy server-administration page so I don't understand why Servoy has no functionality to readout important informations like that.
Anyway, i will create a workaround to get these informations.
Michael Harms
Briese Schiffahrts GmbH & Co.KG, Germany
- Servoy 8.1.4 Running on Windows 2008R2 DataCenter - MSSQL2008
User avatar
briese-it
 
Posts: 122
Joined: Mon Jun 20, 2011 1:50 pm
Location: Leer, Germany

Re: Logging Client IPAddress/Hostname

Postby steve1376656734 » Tue Apr 25, 2017 10:06 am

I use the UserManager plugin to do exactly what you want. plugins.UserManager.Client().hostAddress should give you the client IP address of the current client as shown in the screenshot which is taken from a web client:

IP Address.png
IP Address.png (153.47 KiB) Viewed 1111 times


Hope this helps
Steve
Steve
SAN Developer
steve1376656734
 
Posts: 187
Joined: Fri Aug 16, 2013 2:38 pm
Location: Lanzarote

Re: Logging Client IPAddress/Hostname

Postby briese-it » Tue Apr 25, 2017 10:18 am

That's not correct, Steve.
Running webclient from WAN shows the application servers external IP, Hostname etc.
Michael Harms
Briese Schiffahrts GmbH & Co.KG, Germany
- Servoy 8.1.4 Running on Windows 2008R2 DataCenter - MSSQL2008
User avatar
briese-it
 
Posts: 122
Joined: Mon Jun 20, 2011 1:50 pm
Location: Leer, Germany

Re: Logging Client IPAddress/Hostname

Postby steve1376656734 » Wed Apr 26, 2017 4:01 pm

Definitely not how it is doing it on my server. I am using it to ensure each user logs on only once from any given IP address and the value I am getting for the HostAddress is definitely the same IP as Servoy is showing in the connected clients screen. The screenshot I posted is taken live from our running server (Centos 7) and the address shown for the UserManager IP address is the WAN address of the server and the one shown as the UserManager host address is that of my ADSL line. I am running Servoy 8.1.2 and UserManager version 2.1.10
Steve
SAN Developer
steve1376656734
 
Posts: 187
Joined: Fri Aug 16, 2013 2:38 pm
Location: Lanzarote

Re: Logging Client IPAddress/Hostname

Postby patrick » Wed Apr 26, 2017 4:10 pm

The UserManager takes it from the same object as servoy-admin... So what you see on the client in servoy-admin is what you get from UserManager.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3621
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: Logging Client IPAddress/Hostname

Postby briese-it » Thu Apr 27, 2017 11:11 am

That's strange because it's different in my solution. Maybe because I use it in the frameworks authentication module?
Now I will try to hand it over to the authenticator solutionType with the authenticationObject. Maybe that's the trick.
Michael Harms
Briese Schiffahrts GmbH & Co.KG, Germany
- Servoy 8.1.4 Running on Windows 2008R2 DataCenter - MSSQL2008
User avatar
briese-it
 
Posts: 122
Joined: Mon Jun 20, 2011 1:50 pm
Location: Leer, Germany

Re: Logging Client IPAddress/Hostname

Postby patrick » Thu Apr 27, 2017 12:17 pm

The authenticator is a solution that always runs server side... That's the whole point about it :)
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3621
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: Logging Client IPAddress/Hostname

Postby briese-it » Thu Apr 27, 2017 12:30 pm

I see.
Perfect, then my idea with passing the client informations as parameter to the authenticationObject should work. I'll see it this evening after updating the server.
Michael Harms
Briese Schiffahrts GmbH & Co.KG, Germany
- Servoy 8.1.4 Running on Windows 2008R2 DataCenter - MSSQL2008
User avatar
briese-it
 
Posts: 122
Joined: Mon Jun 20, 2011 1:50 pm
Location: Leer, Germany


Return to Servoy Client

Who is online

Users browsing this forum: No registered users and 4 guests