As you have seen in the previous texts, peers in a P2P network communicate by sending messages to each other. Four different messages are needed to make the basics of a P2P work. These messages are:
- Copy Routing Table
- Find Closest
I'll describe each message below.
The join messsage is sent by a peer joining a P2P network to one of the peers in the network. The contacted peer responds with a GUID to the joining peer.
When a peer wants to leave a network P2P network it sends a leave message to all peers in its routing table. Thus, these peers can remove the leaving peer from their routing tables.
Copy Routing Table
The copy routing table message is sent by a joining peer to get an initial routing table to use to build its own routing table.
The copy routing table message can also be used to inspect the peers in the network, to monitor how well the join, leave and routing table management mechanisms keep their routing tables up-to-date.
The find closest message is sent by a peer searching for a specific GUID (peer) in the network. The peer receiving such a message will respond with the closest GUID it has in its routing table, or its own GUID if that is the closest GUID to the target GUID that it knows.