Application Layer – Peer to Peer (P2P) File Sharing Protocol And Architecture

Hello Friends !!

You may wonder that why we are again repeating this topic. We already covered much interesting stuff related to the transport layer of the TCP/IP model in the previous posts. Now I think we should again throw some light on the most important topic of the application layer (i.e. file sharing).

I just realized that , we covered the topic earlier but not in a detailed manner (i.e. by relating it to real-life applications). So hold yourself tight and enjoy this post regarding the Peer to peer (p2p) file-sharing protocol.

The two network application architectures are client server architecture and peer to peer (p2p) architecture . The application architecture is designed by the application developer and it will dictate how the application is structured over the various end systems.

In a client-server architecture, there is always a host called a server (data center) , which services requests from many other hosts, called clients.

In this architecture, clients do not directly communicate with each other. Examples are Google , Amazon , Ebay , Yahoo mail , Facebook , Youtube etc.

Peer To Peer (P2P) File Sharing Architecture

In peer to peer file sharing architecture, there is minimal (or no) dependency (reliance) on always – on infrastructure servers. Instead the application exploits direct communication between pairs of intermittently connected hosts, called peers.

The peers are not owned by the service provider but are instead desktops and laptops controlled by users with most of the peers residing in homes , universities and offices.

Because the peers communicate without passing through a dedicated server , the architecture is called p2p file sharing architecture. Some of the famous examples include Skype , Bit torrent , Limewire , etc .

One of the most attractive features of this peer to peer architecture is their self scalability. 

For example , in a p2p  file sharing application, although each peer generates workload by requesting files , each peer also adds service capacity to the system by distributing files to other peers.

P2p architecture is also most effective since they normally don’t require significant server infrastructure and server bandwidth.

P2p file sharing allows users to access media files such as books , songs, movies, and games using a p2p software program that searches for other connected computers on a p2p network to locate the desired content online.

Peer to peer file sharing became popular in 1999 with the introduction of Nepster , a file-sharing application .

A limitation was that only the music files could be shared. After Napster was shut down, the most popular p2p file sharing services were Gnutella and Kazaa .

These services allowed users to download music , movies and games. At present, the most popular p2p file sharing protocol is Bit Torrent .

Now let us understand the working of the two most popular p2p file sharing applications at present .

How does Bit Torrent (p2p file sharing service )  works ? 

There is hardly anyone who doesn’t know what a bit torrent application is . So this is one of the most popular peers to peer file sharing applications present among us.

In bit torrent  application , the collection of all peers (nodes) participating in the distribution of a particular file is called a torrent .

Peers in a torrent download equal size chunks file from one another. With a typical chunk size of 256 kb , when a peer first join torrent , it has no chunks.

While it downloads chunks , it will also upload chunks to other peers . when a peer completely downloads a file, it will become an additional seed .

Each torrent has an infrastructure node called a tracker . When a peer joins a torrent , it registers itself with the tracker i.e. the tracker simply keeps track of the peers that are participating in the torrent.

Application Layer - Peer to Peer (P2P) File Sharing Protocol And Architecture

When a new peer ‘X’ joins the torrent, the tracker randomly selects a subset of peers from the set of participating peers and send the IP address of these peers to ‘X’ .

Processing this list of peers , ‘X’ attempts to establish a TCP connection with the peers. Once the TCP connection is established, peers become neighboring peers for ‘X’ . 

Further, ‘X’ uses a technique called rarest first for selecting chunks from neighboring peers. ‘X’ gives priority to the neighbors that are currently supplying data at the highest rate.

To send or receive files the user must have  bit torrent client installed in their host machine(computer). A computer program that implements the bit torrent protocol are µTorrent , Bitcomet etc. The most well-known bit torrent tracker is The Pirate Bay .

Chunks (pieces) of content are typically downloaded non sequentially and are rearranged into the correct order by the Bit Torrent client. Pieces are of the same size throughout a single download.

Due to the nature of this approach, the download of any file can be halted at any time and be resumed at a later date , without the loss of previously downloaded information . This in turn makes Bit torrent useful in the transfer of larger files.

Bit torrent doesn’t offer anonymity to its users. It is possible to obtain the IP address of all current and possibly previous participants from the tracker.

It may expose users to the risk of being sued (for copyright violations and many other cases) , if they are distributing files without the permission from the copyright holders.

Search engines allow the discovery of torrent files that are hosted and tracked on other sites eg Torrentz , The Pirate bay , etc.

Bit torrent and Malware

Several studies on Bit torrent have indicated that a large portion of files available for download via Bit torrent contains malware (viruses, worms , Trojan horse etc).

Skype –  A popular peer to peer  application

Skype is an immensely popular p2p application. It is a telecommunication software that specializes in providing video chat and voice calls from computers , tablets, and mobile devices via internet  to other devices  or telephone/smartphone .

Users can also send instant messages , exchange files and images, send video message and can create conference calls. it was first released in August 2003,  and ebay acquired Skype in Sept 2005 . Skype was later acquired by Microsoft corp in May 2011.

 

Application Layer - Peer to Peer (P2P) File Sharing Protocol And Architecture

 

Skype allows users to communicate  by voice calls using a microphone , video by using a webcam and instant messaging over the internet. Skype to Skype calls are totally free of charge .

While calls to landline telephones and mobile phones are charged via a debit based user account system called Skype credit.

Skype originally featured a hybrid peer to peer and client server system, however since May 2012 , Skype is entirely powered by Microsoft operated supernodes (super peers).

Skype includes an index that maps  Skype username  to current IP address. This index is distributed over the supernodes . Let us understand its working  :

When user ‘A’  wants to call user ‘B’ , A’s Skype client searches the distributed index (client server)  to determine B’s current IP address. TCP connection between A and B is used for communication then.

The online number (SkypeIn) service allows users of Skype to receive calls on their computers dialed by conventional phone subscribers to a local Skype phone  number. Local numbers are available for Australia , Brazil , France , Germany , Hongkong , Japan , Nepal , South Africa,  South Korea, UK and USA (SkypeIn countries) .

Now Skype has become the largest international voice carrier (by minutes of calls , 40%).

Skype runs on a number of platforms including Microsoft windows, OS , Linux , Android , Blackberry IO , IOS , and windows phone .

Skype offers a Skype wifi phone , which is a wireless mobile phone that allows users to make Skype calls . It can also be used in order to talk with non Skype users.

The Skype wifi doesn’t contain a web browser and so can’t access hotspots that require web based login.

Protocol used in Skype 

Skype uses a  proprietary internet telephony (VOIP) protocol called the Skype Protocol. The main difference between Skype and standard VOIP clients is that Skype operates  on a peer to peer  mode , rather than standard VOIP client-server model.

Skype only supports the IPV4 protocol (and not IPV6) . Skype’s packet transmission (voice and control packets) are encrypted.

No Skype calls within India

Since 10th Nov 2014, no Skype calls can be made from Skype to any mobile phone or landline telephones in India. Users in India can still make Skype to Skype calls free of cost worldwide. All users outside the country can call mobiles and landlines in India.

Stay tuned for more interesting stuff in this series. 

Spread the Wisdom !!

Techie Aric

Aric is a tech enthusiast , who love to write about the tech related products and 'How To' blogs . IT Engineer by profession , right now working in the Automation field in a Software product company . The other hobbies includes singing , trekking and writing blogs .

Leave a Reply

Your email address will not be published. Required fields are marked *