简体   繁体   中英

Remote Desktop App with RMI

I'm trying to create a desktop app with RMI (Java) for school. It's a simple chat app and I found plenty of examples about creating a chat app with 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?

2)Can I create peer-to-peer connection with sockets or there is another way on doing this?

Thank you very much.

1.You should detect a remote exception error or server is when unreacehable using

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. 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.

2.Sockets and Yes sockets are pretty enough for peer-to-peer connection!!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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