简体   繁体   English

P2P文件共享应用

[英]P2P file sharing application

I have developed a simple file sharing application in java using TCP socket. 我已经使用TCP套接字在Java中开发了一个简单的文件共享应用程序。 Now, the question is how do i make this application P2P? 现在,问题是如何使该应用程序成为P2P? Can Distributed Hash Table (DHT) do that or there are other options that i can implement in my application to make it P2P? 分布式哈希表(DHT)可以做到吗,或者我可以在应用程序中实现使其成为P2P的其他选项? I have been trying to get ideas on this for a long time but i only get more confused. 很长时间以来,我一直在努力寻求想法,但我只会更加困惑。 Please help. 请帮忙。

Based upon your description it sounds like you have already created a simplistic P2P application. 根据您的描述,听起来您已经创建了一个简单的P2P应用程序。 If you are looking for the next step I would setup a DHT server ( bamboo ). 如果您正在寻找下一步,我将设置一个DHT服务器( Bamboo )。 Next, modify your original application to get a list of available files from the DHT instead of connecting directly to the other peers for file lists. 接下来,修改原始应用程序以从DHT获取可用文件列表,而不是直接连接到其他对等文件列表。

I develop a simple P2P file sharing application in java too,but i find it hard . 我也用Java开发了一个简单的P2P文件共享应用程序,但是我觉得很难。 If you write it in java . 如果用java编写。 You can search for Vuze or jBittorrent , which may help you develop it faster. 您可以搜索Vuze或jBittorrent,这可以帮助您更快地进行开发。

The Forest platform which is in early development is targeting applications like your. 正在开发中的Forest平台正在针对像您这样的应用程序。 You might want to take a look at it. 您可能想看看它。

The only problem is that it is still in development and is not yet usable. 唯一的问题是它仍在开发中,尚无法使用。 I advise you to keep an eye on it and try to use it once it reaches it first release. 我建议您密切注意它,并在它首次发布时尝试使用它。

EDIT to answer the comment under your question: 编辑以回答您的问题下的评论:

Your application would need to connect the some peers. 您的应用程序需要连接一些对等端。 Depending on how you choose them (random people or know contacts), you are using respectively a peer-to-peer ('p2p') network or a friend-to-friend ('f2f') network. 根据您选择他们的方式(随机的人或认识的联系人),您分别使用对等('p2p')网络或朋友对朋友('f2f')网络。

Forest is providing applications a f2f network, but application are free to route messages on the top of this network to achieve (anonymous) p2p. Forest正在为应用程序提供f2f网络,但是应用程序可以自由地在此网络的顶部路由消息以实现(匿名)p2p。

For a classical p2p network, you would need to connect a DHT, and you would need to bootstrap to it via a (or some) server(s) which take part in the DHT. 对于传统的p2p网络,您需要连接DHT,并且需要通过参与DHT的(或某些)服务器引导到该DHT。

In general, p2p application are not so simple to do, and you will need to deal with a lot more details here and there. 通常,p2p应用程序并不是那么简单,并且您将需要在这里和那里处理更多的细节。 If you really want to experiment with them, you can go to check existing DHT libraries and see how they work. 如果您真的想尝试使用它们,则可以检查现有的DHT库并查看它们的工作方式。 You might first want to go to read the article on Wikipedia about Kademlia which is the base for the most used DHT algorithms. 您可能首先要阅读Wikipedia上有关Kademlia的文章,该文章是最常用的DHT算法的基础。

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

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