Developing Peer to Peer application in Java [closed]

南楼画角 提交于 2019-11-28 17:59:19

问题


i've got a university project where i need to develop a peer to peer system in java for file sharing.

So in essence several users should be able to share files using the Peer to Peer System.

Can someone give me some guidelines about how to build this system??


回答1:


For university project read some tutorial about sockets. I believe that this is what your professor is expecting from you. Take for example the following: http://www.oracle.com/technetwork/java/socket-140484.html

There are 2 general solutions: server-full and server-less. In case of server based solutions all your clients should be pre-configured with the server's IP address. Server opens server socket and starts listening. So, each client connects to server and registers. The registration is very simple: server just needs the client's IP. Now server holds a list of connected clients and sends the list to each client. To make peer2peer app each client opens server socket too. When client A wishes to connect to client B it just connects to its socket.

You can implement server-less solution. In this case you need some discovery mechanism based for example on broadcasting.

I hope this helps. Good luck.




回答2:


You want to check JXTA. The site has moved to jxse.kenai.com. The practical JXTA II book has been made available for reading on Scribd.



来源:https://stackoverflow.com/questions/4920527/developing-peer-to-peer-application-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!