Callee remote method中有没有办法确定调用者进程。
假设有 3 个客户端和一个服务器,服务器有一个远程方法,所有客户端都调用该方法。是否可以在运行时确定哪个客户端进程调用了远程方法? (除了在方法中传递进程名称)
Server
void callMe(){//remote method
System.out.println("I was called by Client : " + ? );
}
Client
...
...
server.callMe();
...
...
最佳答案
参见 Determine remote client IP address for Java RMI call和 Get the client Ip address in RMI Server when cleint makes a call registry.lookup("RMI Server")
关于Java RMI : Determining Caller process from Callee,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5775661/