Peer-to-Peer Networking: An Overview

Computer mouse with blue arrows
Marcello Bortolino/E+/Getty Images
of 04

Peer-to-Peer Networking: An Overview

Peer-to-Peer (P2P) networks function similarly to other networks in that they follow a general client-host model. The differences lie in the number of hosts used by a given client and the way the client finds the host to be contacted. In this way, the various P2P implementations vary based upon two basic dynamics: hierarchy (which peers count as possible hosts) and structure (how information is communicated to potential clients).

of 04

Python Networking: Peer-to-Peer Networking: A Network is a Network

At its base, the Internet and most network structures use a rigid hierarchy of network nodes, domain names, and DNS servers to ensure that "" reconciles to The multi-level, interdependent DNS servers ensure that the DNS listings are updated every 24 hours or so.

In a peer-to-peer model, the same basic dynamics are at work. One computer functions as a client, another as a host, and a database whereby the location of the host (i.e., its IP address) is made known to the client in some way. With that IP address, the computer that functions as a client can contact the host directly using a procedure similar to that of a basic web client.

The de facto host application simply sits on the remote computer, watching a port and and waiting to be contacted. It could be part of a larger application that also includes client-like functionality. The point is that, like the interaction between a web server and a web browser, traffic is sent on a given port, and all traffic received by that port is processed by the same application.

of 04

The Difference: The DNS-like Dynamic

The major difference between the various P2P applications comes down to how the database of IP addresses is generated and administered. This dynamic influences the level of the hierarchy and the relative looseness of the P2P network.

In addition to using a different port from most other Internet-oriented applications, P2P programs have flown under the radar of many network administrators because they do not have many—if any— host addresses hard-wired into them. Where most networks used to guard certain ports but leave the others open, the smart network administrator now uses firewall rules to block all but essential ports.

The rigidity of the P2P structure is directly correlated to how centralised its database structures is. When the P2P program is first installed, it must have a way of contacting at least one other node in the network. From this node, the newly installed program will learn the addresses of others within the immediate network, progressively learning the locations of other peers.

of 04

Degrees of Separation: Populating the Peer Database

When the P2P program is first installed, the program can populate its database in one of three ways. It can (1) rely exclusively on hard-wired data, (2) rely on hard-wired data at first but supplant it with dynamically-learned data after contacting the network, (3) gather all of its data dynamically. In practice, a spectrum of variations are commonly used which encompass the first and second option. The third option is simply not practicable because it would require scanning every conceivable Internet address (yes, all 255,255,255,255 of them).

At the two ends of this spectrum are systems like Usenet and Gnutella. In the case of Usenet, clients upload messages to a particular server which then replicates those messages and sends them to other servers within the system for mirroring, making them available to users throughout the system. This is essentially decentralised hosting. The servers themselves relate on a peer-to-peer basis, but the user clients do not.

In the case of Gnutella, however, peer-to-peer is extremely decentralised. You cannot join the network unless you know at least one member. This member then "introduces" you to his/her circle of friends, thus populating the database of peers for your Gnutella installation (for acting both as client and as host). Few, if any, ever get the full database of potential peers because addition to the ring of trust requires knowing someone else.