确定 Java RMI 调用的远程客户端 IP 地址

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/590257/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 12:59:18  来源:igfitidea点击:

Determine remote client IP address for Java RMI call

javanetworkingclient-serverrmi

提问by Thilo

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?

当我实现 RMI 服务器(实现扩展 java.rmi.Remote 的接口)时,有没有办法获取有关当前 RMI 请求上下文的信息,特别是远程客户端的 IP 地址?

public void myMethod() throws RemoteException {

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

}