[bluebox] getting user IP upon user login in Java ext

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

Moderators: Lapo, Bax

User avatar
levancho
Posts: 71
Joined: 27 Jun 2011, 16:03

[bluebox] getting user IP upon user login in Java ext

Postby levancho » 09 Sep 2011, 16:41

Hi,

I would like to get a IP of the user and log it into my DB a an audit record,

I found several threads that state how to get IP from SocketChannel but how do I get a SocketChannel reference?

I need this info inside login event handler method, so I have event parameter, but API docs does not state any method that gives me SocketChannel from event object,

event.getParameter("chan"); there must be something like this right?

second question: Is there any way to get an IP if user is connected through blueBox?
I read in this thread : viewtopic.php?t=2766&highlight=getinetaddress
that bluebox returns always localhost IP, but it islittle bit old thread so maybe there has be addition to bluebox to retreive user IP?

this is quite important for me since I must log every single attempt on login with proper IP address.
Last edited by levancho on 14 Sep 2011, 14:43, edited 1 time in total.
Alex
Posts: 131
Joined: 03 Sep 2006, 09:15

Postby Alex » 09 Sep 2011, 17:38

Hi

You can try this inside you login handler:

Code: Select all

ISession session = ( Session ) event.getParameter( SFSEventParam.SESSION );

//trace the ip
trace( session.getAddress() );

//trace ip:port
trace( session.getFullIpAddress() );


Not sure if it will work with the bluebox though.
User avatar
levancho
Posts: 71
Joined: 27 Jun 2011, 16:03

Postby levancho » 11 Sep 2011, 04:20

thanks for reply, that worked,

does anyone has an answer regarding blueBox?

there must be a way to get user IP address this way too.
User avatar
levancho
Posts: 71
Joined: 27 Jun 2011, 16:03

Postby levancho » 14 Sep 2011, 14:42

Smartfox Team, can you shed light on this issue?

no response means bluebox still does not support ways to get user IP address?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 19 Sep 2011, 06:06

If you are using SFS2X RC3 you should be able to always obtain the remote address, regardless of the connection type
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Thomasea and 56 guests