how to get clients external IP in java extension

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

agrios
Posts: 18
Joined: 20 Oct 2010, 20:42

how to get clients external IP in java extension

Postby agrios » 08 Jul 2011, 13:36

Once client is connected,
how can I access his WAN IP
in server side Java extension?

nobody?

I was able to get LAN IP with this:

Code: Select all

String checkIP(SocketChannel ch)
{
    return ch.socket().getInetAddress().getHostAddress();
}

but WAN IP seems like big NONO
with AS2 in current Adobe Flash player.
Seems like I can only get PHP output on local
domain... not from external server.
Obviously PHP server will be external to user.

Is even users external IP visible from SFS server?
User avatar
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Postby BigFIsh » 08 Jul 2011, 22:14

What you're using is correct.

I think if you use that for clients inside the same network in which the server is located on, you would get the LAN/private IP address. Have you tried that method for clients outside your network?
Smartfox's forum is my daily newspaper.
agrios
Posts: 18
Joined: 20 Oct 2010, 20:42

Postby agrios » 10 Jul 2011, 16:09

BigFIsh wrote: Have you tried that method for clients outside your network?


Yes, you are right, it works.
Outside of our LAN shows external IP.
Thanks BigFIsh!

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 59 guests