|
|
|
1000 Java Tips ebook
|
|
 

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java
programming articles and tips. Please take your copy here.
Take your copy of free "Java Technology Screensaver"!. |
|
I work with RMI now and need to implement a new feature into software that was w
|
JavaFAQ Home » Networking

Question:
I work with RMI now and need to implement a new feature into software that was
written by another people one year ago. I need to find out: what is IP address
of a client and then connect or reject the connection. I do not want to add
methods to client... It must be the way how to find out it using RMI methods.
Unfortunately I did not find with first attempt.
Answer:
Your RMI server extends UnicastRemoteObject that extends
java.rmi.server.RemoteServer.
That class (RemoteServer) has public static String getClientHost() method.
When called from a thread actively handling a remote method invocation the
hostname of the client is returned.
Then use public static InetAddress
getByName(String host) method of java.net.InetAddress
Be aware that you do need to try to create an instance of InetAddress. It is
static.
Just get it!
*******************************************
Our older tips: March 22, 2001 - October 21, 2002
READ
HERE
All published and not published on the site tips read
HERE
Printer Friendly Page
Send to a Friend
..
Search here again if you need more info!
|
|
|