Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine remote client IP address for Java RMI call

When I implement an RMI server (implement an interface that extends java.rmi.Remote) is there a way to get information about the current RMI request context, specifically the remote client's IP address?

public void myMethod() throws RemoteException {

    log.info("remote IP is "+ RMISomething.getSomething());

}
like image 388
Thilo Avatar asked Feb 26 '09 12:02

Thilo


People also ask

How can a client get access to a remote object in RMI?

To make a remote object visible to clients through the RMI registry service, you need to explicitly create the object inside a Java VM on the server and then register that object using the bind() or rebind() method on the Registry.

Which method is used to identify the remote object in RMI?

The string name accepted by the RMI registry has the syntax "rmi://hostname:port/remoteObjectName", where hostname and port identify the machine and port, respectively, on which the RMI registry is running and remoteObjectName is the string name of the remote object.

How does RMI communicate with the remote object?

RMI uses stub and skeleton object for communication with the remote object.


1 Answers

See java.rmi.server.RemoteServer#getClientHost

like image 74
Kevin Avatar answered Sep 28 '22 02:09

Kevin