P2P通信方式
我一直在尝试服务器-客户端应用程序编程,并想探索 P2P。我不知道从哪里开始。
我正在考虑一种方法,(每个用户称为一个节点)
每个节点都由服务器和连接到其他节点的服务器的不同客户端实例组成。所以基本上node1是node2和node3的服务器和客户端,node2是node1和node3的服务器和客户端,node3是node1和node2的服务器和客户端。节点可以通过向中央服务器提交信息来了解彼此。
我不确定这是一种盗版方法,因为如果节点数量增加,我认为这不会真正起作用。
我正在寻找的是资源或其背后方法的基本思想,或者我是否走在正确的轨道上。
提前致谢。
I've been experimenting with server-client application programming and want to explore P2P. I don't know where to start.
I was thinking of a method, (each user is referred to as a node)
Each node is built up of a server and different client instances connected to other node's servers. So basically node1 is a server and client to node2 and 3, node2 is a server and client to node1 and node3, and node3 is a server and client to node1 and node2. And the nodes would know about each other by submitting information to a central server.
I am not sure it this is a piratical method, because if the number of nodes increases I don't think this could really function.
What I am looking for is resources or a basic idea of the method behind it, or am I on the right track.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常,人们谈论两种类型的对等点:边缘对等点(= 您所说的客户端对等点)和超级对等点(= 您所说的服务器对等点)。通常,超级对等点是具有额外功能以支持 P2P 网络结构的边缘对等点。
因此,您不能(也不应该)让给定的对等方充当某些对等方的服务器和其他对等方的客户端。它应该与每个人都是边缘或与每个人都超级。
您需要发布一组种子(即超级节点的位置),而不是中央服务器。然后,边缘节点获取这些种子并开始连接到超级节点之一。 P2P 网络中不存在中央服务器,而是一组超级对等点。
Often, people talk about two types of peers: edges peers (= what you call client peer) and super peers (= what you call server peer). Typically, a super peer is an edge peer with extra functionalities to support the structure of the P2P network.
So, you can't (and should not) have a given peer behaving as a server from some peers and as a client for others. It should be edge with everyone or super with everyone.
Instead of a central server, you need to publish a set of seeds (i.e., location of super peers). Then, edge peers fetch those seeds and start to connect to one of the super peers. There is no such things as a central server in a P2P network, but rather a set of super peers.
您可能想查看 ZeroMQ 库和 相关指南 - 其中有一些关于设计这样的分布式系统的有用内容,以及您会发现的一些相关问题。
You might want to take a look at the ZeroMQ library and associated guide - there's some useful stuff in there about designing distributed systems like this, and some of the associated problems you'll find.