Identify Client application name

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
stelarfox
Posts: 34
Joined: 06 Aug 2021, 14:33
Location: Argentina, BsAs

Identify Client application name

Post by stelarfox »

Hello, I am trying to add certain degree of security for an application.
And noticed that when you go into the ZoneAdmin->Zone->User (while a user is connected)
You can see their IP, Region and Program they are running from (in my case Unity / net#) (or similar).
But I did not find any way from the server to get that string or code.
Is it possible or is something only the Admin program can do because it check the TCP IP Packet and is not an info the smartfox gives?
I tried to check by the user methods and parameters, and the ones inside them. but if it was there was unable to found (not even searching online).
So is it possible or i am wasting time?
If it is possible how?
Thank you.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Identify Client application name

Post by Lapo »

Hi,
it's not directly exposed but you can get it via this:

Code: Select all

String appType = (String) user.getSession().getSystemProperty(SFSConstants.SESSION_CLIENT_TYPE);

We could add this as a method on the User object for more convenience.
Also, keep in mind that you can change the "client type" from client side, in case you need to identify different versions of the same client or different client Apps.

See the client side API --> SmartFox.setClientDetails(...)

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
stelarfox
Posts: 34
Joined: 06 Aug 2021, 14:33
Location: Argentina, BsAs

Re: Identify Client application name

Post by stelarfox »

Thank you so much, I arrived to the Session but was unable to pass the correct parameters to that function.
any place were i can know what parameters to pass in order to get anything else?
...
Never mind found they are in SFSConstants.
Just to say but, will be great if you put in the program the help to be seen into the methods will help a lot. In case you do not get what i mean is.

Something like this:

Code: Select all

/**
    * Given a sfsobject and the key, returns an int[] of that key intArray
    * If there is none for any reason (or empty) gives null as return
    * <p>
    *
    * @param  obj An ISFSObject, can be null but then will give null.
    * @param  key the key to check inside the SFSObject.
    * @return      int[] the int array.
    */
    static public int[] getIntArray(ISFSObject obj, String key) {
        return getIntArray(obj, key, null);
    }


Doing that it is a LOT explanation and in this case will be good to include the possible types. and what each of then do
but when i try this in my viewer it gives garbage like:Javadoc not found ...
and only shows me the method name and other things. Is something configured wrong or i need something else than the jar file to get the help too?
Thanks even if now another question.
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Identify Client application name

Post by Lapo »

You need to download the javadoc and add it your IDE:
https://www.smartfoxserver.com/download#p=extras

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
stelarfox
Posts: 34
Joined: 06 Aug 2021, 14:33
Location: Argentina, BsAs

Re: Identify Client application name

Post by stelarfox »

Thanks a lot!
Post Reply