简体   繁体   English

带有RMI的远程桌面应用

[英]Remote Desktop App with RMI

I'm trying to create a desktop app with RMI (Java) for school. 我正在尝试为学校创建带有RMI(Java)的桌面应用程序。 It's a simple chat app and I found plenty of examples about creating a chat app with RMI. 这是一个简单的聊天应用程序,我发现了很多有关使用RMI创建聊天应用程序的示例。

The "problem" is that I have to make this app fault tollerant, so my professor asked me to create also a peer-to-peer connection between clients if the server doesn't work. “问题”是我必须使该应用程序容错,因此,如果服务器不工作,我的教授还要求我在客户端之间创建对等连接。 So I have to create two types of connections: client/server and peer-to-peer. 因此,我必须创建两种类型的连接:客户端/服务器和点对点。 I have two questions: 我有两个问题:

1) Which is the best way to save the data in the local client side in order to access them if the server doesn't work? 1)如果服务器不工作,最好的方法是将数据保存在本地客户端以便访问它们?

2)Can I create peer-to-peer connection with sockets or there is another way on doing this? 2)我可以使用套接字创建对等连接吗,还是有另一种方法?

Thank you very much. 非常感谢你。

1.You should detect a remote exception error or server is when unreacehable using 1.您应该使用以下命令检测到远程异常错误或服务器无法启动

try {


}
catch(RemoteException ex){
 //do some peer - to -peer look up here or other way

}

in your client code which tries to connect to server and when accessing a STUB on RMI. 在尝试连接到服务器以及在RMI上访问STUB的客户端代码中。 Second , you need a central server location that Peer-TO-Peer data exchange is possible.AT least when every peers comes in to connecting to the central server(RMI server) or want to chat additionally it needs to record some information about him self in some other shared data repository.This not the best answer but ,just an ice breaker. 其次,您需要一个可以进行对等数据交换的中央服务器位置。至少在每个对等方都进入连接到中央服务器(RMI服务器)或想要聊天的情况下,它需要记录一些有关他自己的信息在其他共享数据存储库中。这不是最佳答案,只是一个破冰船。

2.Sockets and Yes sockets are pretty enough for peer-to-peer connection!! 2.Sockets和Yes套接字足以进行点对点连接!

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

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