Skip to main content

How can I get the client's IP?

2 replies [Last post]
Joined: 2009-06-14

I run the DiscoveryServer application(the code of DiscoveryServer in tutorials directory)
when the client connect the server,console display message like this:
2009-6-14 18:02:33 net.jxta.impl.endpoint.tcp.TcpMessenger
信息: Creating new TCP Connection to : tcp:// /

how can i get the client's IP(
and use System.out.println to display the client's IP in console ?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-10-27

Not sure why you need this - please give more detail.

JXTA is a network overlay, therefore IP Address in not exposed in the API for communication. And the IP you see is only the IP of a particular transport connection. This for instance could refer to a connection to a relay service and not the peer you are communicated with over pipes.

Therefore, using IP for anything is not a good idea.

Joined: 2009-06-14

Thank U for your help. I will try the other way to get the client information