P2PSP (Peer-to-Peer “Straightforward” Protocol)

4.13 The Peer-list Compression Set of rules

$S$ maintains the list of peers $\left\{T\right\}$ ordered according to the numerical order of the IP addresses of the end-points of the peers. Thanks to this and depending on the compression ratio, the splitter should minimize the transmission time of the list of peers by compressing it with the Algorithm 7. Notice that only the IP addresses of the end-points are compressed.

1. Send 4 bytes for $T\left(0\right)$.
2. Send 2 bytes for “A”, “C” or “C”, depending on type of network that is going to be sent next.
3. Send 3 (A class), 2 (B class) or 1 (C class) bytes to encode the rest of peers of $T$ that are in the sub-network speciﬁed in the previous step.
4. For each peer in the sub-network:
1. Send the host part of the IP address of the peer, using 3 (A class), 2 (B class) or (C class) 1 bytes.
2. Send the port of the peer using 2 bytes.

Algorithm 7: : Compression algorithm of the list of peers.

P2PSP (Peer-to-Peer Straightforward Protocol) by Cristobal Medina-López, J. A. M. Naranjo, L. G. Casado and Vicente González-Ruiz