Take the 2-minute tour ×

Can anyone explain how I can get the client IP of the Java RMI programming, including a sample of how to use it?

I have looked up the Java API, but it is hard to understand.

I would like to print the client IP on server

share|improve this question
what do you have that isn't working? –  jtahlborn Apr 16 '12 at 20:04
What don't you understand? What's your question? –  EJP Apr 16 '12 at 22:35
I added the coding, it should be more helpful. –  goodseller Apr 17 '12 at 5:15
add comment

2 Answers

up vote 1 down vote accepted

The only method in the RemoteServer class that you ever need to call is getClientHost(). That's the one that does what you asked about in your title.

share|improve this answer
add comment

I found the solution and what you guys meaning, thanks:

We need a try-catch to handle the getClientHost() function in the interface implementation of server.

Here's the code:

    System.out.println(getClientHost()); // display message
}catch(Exception e){}
share|improve this answer
add comment

Your Answer


