P2P methods of communication
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 node开发者_开发知识库3, 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.
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.
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.
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.
精彩评论