What is Peer-to-Peer (P2P) File Sharing and How Does it Work?

A P2P network, as understandable from its name, helps transfer files between two ordinary computers (peers); like mine and yours.

P2P as a network contains thousands of computers (peers) connected to each other in an ad-hoc manner. (For an ad-hoc network the number of peers, peers adding on to the network and peers leaving the network don’t have a noteworthy impact on the network.) This means that any user can join in the network or leave it on his own without disturbing the network’s functionality.

The term ‘Peer-2-Peer file transfer’ doesn’t quiet makes a sense to everybody. For instance, one might think of a simpler name like file transfer network (assuming it obvious to have a sender if there is something to be received). Yes, there always has to be a sender if there is a recipient, but traditionally networks don’t have a peer transferring file to another Peer.

To understand the P2P file transfer, and how is it different from former methods, let us first get an insight of how these traditional file transfers were carried out .

How are P2Ps Different From Traditional File Transfer Methods?

The FTP:

The most prevalent file transfer protocol is the File Transfer Protocol (FTP). File transfer using the FTP, in common language is referred as Client-Server file transfer. As the name suggests, the file is downloaded from a single source (the file server) by the destination/PC (a client).

The prime problem in this FTP scheme is the server failure that occurs whenever a file is popular and reasonably larger. When many clients (more than what a server can serve) attempt to download a particular file, the server capacity overshoots resulting in the service being halted for everyone; not the ones beyond the capacity line.

The P2P:

Since a P2P network does not involves a server, the control tasks have to be taken over by a software; installed on every user’s PC to connect to the network. (Most popular P2P softwares are Kazaa, Limewire and Gnutella).

The software serves several purposes. It provides the user interface, connects to other online computers running the same platform software and maintains the network, and locates the files a user wants.

The network is established by a peer finding some other peers to connect to. Each peer then exchanges the addresses of all connected-peers with all other peers connected to it.


In this way, a network is established and user can now search for files by using the hop and ask method.

Now . . . How do u find a file on such networks ?

The P2P softwares follow Publish-Subscribe (Pub-Sub) network architecture. In plain words, a Pub-Sub architecture works as a topic-based sharing system.  Unlike FTP, Pub-Sub file hosts (ordinary computers) label each file with a tag (this is called Publishing the file and the file-name is its default tag) instead of directly transferring it to the recipient. Once a user asks for a specific file by calling its tag (this act is called Subscribing), the sender then allows the transfer.

Four different colored tags in the fig above designate the distribution of four different files on different computers across the P2P network. When a user of a certain computer asks for a file he does not has, the computer queries all the other peers connected to it and searches the network by hopping the connected peers.

All those replying positively make the query-maker legitimate to start the file download.


If a file is available to download from multiple sources, the file will be downloaded from multiple pieces simultaneously. This can make the download faster (however, maximum download speed will be defined by your connection’s top speed even if there are unlimited number of sources available . . . logical).

Multiple-source download does not means that you’ll be downloading multiple copies of files. You are actually downloading one file in several pieces from multiple users, which are assembled when the download completes.

The downloaded file present now available on the user’s hard disk now serves as a source for other peers seeking it . . . and the cycle goes on !

Share
Published by
Saad Chdhry