简体   繁体   English

如何知道哪个客户端在服务器上调用RMI方法

[英]How to know which client invoke RMI method on the server

I'm developing a system using Java RMI. 我正在使用Java RMI开发系统。 I've several RMI clients and one RMI server. 我有几个RMI客户端和一个RMI服务器。 My system is supposed to be Byzantine Fault Tolerant, so the clients can be malicious (not only crash-stop). 我的系统应该是拜占庭式的容错系统,因此客户端可能是恶意的(不仅是崩溃停止)。

In that sense, I should be able to recognize in the server when a client is invoking duplicated or trying to invoking methods using other clients information (to trap de server and the majority voting). 从这个意义上讲,当客户端调用重复的客户端或尝试使用其他客户端信息调用方法(以捕获服务器和多数投票)时,我应该能够在服务器中识别出。 To solve that, I'm using a public/private key shared by client and server. 为了解决这个问题,我使用了客户端和服务器共享的公钥/私钥。 Each client has a unique key to generate and hash and the server will verify the hash. 每个客户端都有一个唯一的密钥来生成和哈希,服务器将验证哈希。 Now, I need to know in the server side which client invoke the method to know which key I should use to verify data. 现在,我需要在服务器端知道哪个客户端调用该方法,以知道应该使用哪个密钥来验证数据。

Is possible to know, on the server, which server are invoking the methods? 是否可以在服务器上知道哪个服务器正在调用方法?

Regards and thank you, Hugo 谢谢,雨果

使用RemoteServer.getClientHost()的结果。

I think the RemoteServer has a method to get the client IP address when someone is invoking a method. 我认为RemoteServer有一种在有人调用某个方法时获取客户端IP地址的方法。

If the IP is sufficient you can look into that. 如果IP足够,您可以进行调查。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM