IP-Port-Number of Client

Forum to discuss the new web client version of Servoy.

IP-Port-Number of Client

Postby rph » Tue Jun 23, 2020 9:59 am

Hi

Is there a way to get the clients IP-Port-Number?

I can get the IP-Address (application.getIPAddress()) or MAC-Address (with it2be_tools) or informations about the agent (plugins.ngclientutils.getUserAgent()) and a bunch of other informations about the client but I couldn't figure out how I could get the Port-Number of the client.

We have an application that logs some critical actions in a log-table. One of our customers wants now as an addition the port-number of the client in this log to disinguish between different Browser-Sessions.

Any ideas?

Thanks in advance
Roland
rph
 
Posts: 76
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland

Re: IP-Port-Number of Client

Postby Andrei Costescu » Tue Jun 23, 2020 11:46 am

Hmm you are searching for the local/client-side port that browser tabs use after connecting to the server to receive data right? So not the server port that the browser connects to? So the client port that is sent in TCP headers.
I didn't search much but I don't know of a standard way of getting to that from a .war file; I'm pretty sure you can't get it directly currently in a solution.

I see some servers like apache (not war container) do provide that if you install some mods but...

What you are saying - from Servoy's point of view - is separating between client application instances right? Can't you use the IClientPluginAccess.getClientID() that is available to Servoy client plugins for what you need (there are I think plugins that already give access to that - like the usermanager plugin)? Does it have to be the client side port number that the browser uses?
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 1018
Joined: Tue Jun 26, 2007 3:14 pm

Re: IP-Port-Number of Client

Postby rph » Wed Jun 24, 2020 8:57 am

Hi Andrei

Thanks for your reply.

I'll have to discuss in detail with our customer what's possible and what's not. The application is used in a police department and there are critical actions that could take in place if it comes to trials. So they want to have as much informations as possible about the person that interacts with the portal. So that's why I asked.

Cheers
Roland
rph
 
Posts: 76
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland

Re: IP-Port-Number of Client

Postby Andrei Costescu » Wed Jun 24, 2020 12:49 pm

Ah ok. Then I guess the more info you log the better.

If you really need that you have to dive into what info is available from .war containers (that could then be made available to solutions in some way). For example HttpServletRequest - where available - does have a .getRemotePort(). But for the websocket connection I see a way to possibly get that at the time the connection is negotiated (through a configurator) but that I guess it is for the negotiation not for the socket itself - not sure where to get that from in the actual socket. I do see it available deep inside Tomcat coyote code (specific for Tomcat websocket impl.) but I'm not sure how that could be accessed from standard interfaces/classes.
Andrei Costescu
Servoy
Andrei Costescu
 
Posts: 1018
Joined: Tue Jun 26, 2007 3:14 pm

Re: IP-Port-Number of Client

Postby rph » Wed Jul 01, 2020 11:20 am

Andrei Costescu wrote:Ah ok. Then I guess the more info you log the better.

If you really need that you have to dive into what info is available from .war containers (that could then be made available to solutions in some way). For example HttpServletRequest - where available - does have a .getRemotePort(). But for the websocket connection I see a way to possibly get that at the time the connection is negotiated (through a configurator) but that I guess it is for the negotiation not for the socket itself - not sure where to get that from in the actual socket. I do see it available deep inside Tomcat coyote code (specific for Tomcat websocket impl.) but I'm not sure how that could be accessed from standard interfaces/classes.



Thanks a lot for your inputs, Andrei. I'll take that in count in the discussions with our customer.
rph
 
Posts: 76
Joined: Wed Aug 10, 2011 11:44 am
Location: Cham, Switzerland


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 13 guests