# A Bit History of Internet/Chapter 6 : Peer-to-peer
## Definition Of Peer To Peer

When referring, in relation to a computer network, to peer-to-peer (P2P), it will mean the network and relation formed by computers connecting to each other, this can be done over the Internet. A “peer” will be the computer that can participate directly with others, over that network, without the need of central server. This requires that a peer (computer) on a P2P network to function like a server as well as client. P2P networks are not exclusively created for file sharing but that is the predominant application of the technology.
The only requirements for a computer to join a peer-to-peer network are a network connection and P2P software. In a file sharing setup a peer will only need to connect with another so that the user can search for files that the other peer is sharing. Common P2P software program that use a P2P network are Bittorent, Limewire, Kazaa, Bearshare and many other similar software.

## Peer to Peer Architectures

P2P is sub-field of distributed systems, mainly focusing in file distribution and indexing but not limited to it. A P2P network is created by using identical software, on different computers. The software communicates with each other, forming a P2P network, to complete the processing required for the completion of the distributed task.
Some of the more recent P2P implementations use an abstract overlay network, where the software is build to function at the application layer on top the native or physical network topology. P2P networks are organized by following specific criteria and algorithms which lead to a specific topologies and properties.
P2P architecture depends in placing a network server as well as a network client on each computer, creating a peer. This will provide users to access services from other computers running the software (or compatible implementations) as well announce local services. P2P architectures are actually more complicated than the client-server architecture. Since there is not a central coordinator, there is a requirement to implement a bootstrap scheme as to allow each peer to know the network address of others, over a highly dynamic network, to be able to participate on the P2P network.
Based on how the nodes are link to each other, P2P can be classified as unstructured P2P and structured P2P. Unstructured P2Ps does not impose any structure on the network. P2P unstructured system have no absolute centralized system.
Then there are 3 types categories can be seen :
* Pure peer-to-peer where consists one routing layer, no preferred nodes with any special infrastructure function.
* Hybrid peer -to-peer often called supernodes. Where it allows such infrastructure nodes to exist.
* Centralized peer-to-peer used for indexing function and bootstrap entire system. It has similarities with structured architecture but the connection between peer not determined by any algorithm.
Structured P2P consists protocol to ensure any node can efficiently route to search some peer that has desired files even if the file is rare to be found. The common type structured P2P is DHT (Distributed Hash Table) consists hashing used to assigned ownership of each to a particular peer.

## How It Works

P2P works over networks with several peers (computers) cooperating without a fixed central server (one that the network depends for its existence, in mixed models there can be multiple servers).
How do you get these millions of peers to communicate/to cooperate/to provide service to each other without having a central server?
1. Several computers all connected to the Internet and wanted to cooperate and communicate with each other. But, if they do not know each other and there’s no central server that they can communicate through, then they need some kind of mechanism that allows them to find each other.
2. All the peers now assigned to have a GUID (Global Unique ID). The peers will identify each other by this GUID. After assigning a GUID to every single peer in the network, the peers are organized into a virtual ring. And the peers are ordered in the ring according to their GUID.
3. This organization is purely virtual or logical. It does not mean that peer 1 is closed to peer 2 geographically. It is just virtual way of organizing the peers into a network. Once the peers are organized into these rings, then somehow each peer needs to have a set of references to other peers in the network so that they will be able to communicate with them. But, it is not possible to for peer to have reference to every single other peer in the network. Therefore, each peer needs to have a reference to a subset of the rest of the peer in the network. Thus, if there are millions peer in the network, and each peer might only have references to few other peers in the network (HOME). We choose peer in the subset based on the distance from a peers’ own GUID.
How do you get them to know each other? You need a boot peer, which has to be the 1st peer in the network. The boot peer has to be known to at least the 1st peer answering the network. The 1st peer, the joining peer, contacts the boot peer and asked to join the network. And then the boot peer responds with a GUID. In some networks, the joining peer might decide the joining GUID. Now the network consists of 2 peers. The next thing that the joining peer does is to ask the boot peer for the copy of the routing table. Then the boot peer would send the copy of the routing table back to the joining peer and the joining peer could use this routing table to build its own routing table. It then will use this temporary routing table to search for its ideal peers in the network. When a connection has been established, the user can then search for files. When a search has been submitted, it connects to all nodes on its connection list. The results are then displayed and a connection is made.
P2P Application Areas:
* File sharing
* Educational search engine
* Video streaming (TV, movies, etc)
* Telecommunications
* Web portals
* Bio informatics
P2P Searching Techniques:
* Flooding queries
* Centralize indexing
* Decentralize indexing
* Crawling
* Hashing
Few examples of P2P networks are such as Kazaa, eMule, Napster, Gnutella, BitTorrent, Ants, Ares, DirectConnect, Freenet, OpenFt, FastTrack, Kad Network, NeoNet, Mute, eDonkey and SoulSeek.

## Peer-to-Peer Application

The applications for peer-to-peer is very wide. One can connect to other user’s machine and giving them the ability to connect to one's machine. It has the ability to discover, query, and share contents with other peers.
The applications of the peer to peer network :
Content distribution
* Babelgum – use a proprietary P2P protocol with an encrypted data stream to prevent piracy.
* Blinkx BBTV - fuses TV and other video from the web using hybrid peer-to-peer streaming which enables content providers to disperse the burden of content delivery through the blinkx network and peer-to-peer distribution.
* Jaman - provides pieces of the movie via their server and via P2P.
* Software publication and distribution (Linux, several games); via file sharing networks.
* Peercasting for multicasting streams.
Exchange of physical goods, services, or space.
* Peer-to-Peer renting web platforms enable people to find and reserve goods, services, or space on the virtual platform, but carry out the actual P2P transaction in the physical world.
Networking
* Domain Name System, for Internet information retrieval.
* Cloud computing
* Dalesa a peer-to-peer web cache for LANs (based on IP multicasting).
Science
* The sciencenet P2P search engine.
* BOINC - Open-source software for volunteer computing and grid computing.
Communications networks
* Skype, one of the most widely used internet phone applications is using P2P technology.
* VoIP (using application layer protocols such as SIP)
* Instant messaging and online chat.
File sharing
* Film
* Video
* Music and Audio
* Computer applications
Privacy protection
* Tor – shields its user’s identities by sending their traffic through a network of relays set up by volunteers around the world.
Business • Collanus Workplace – cross platform peer-to-peer system for collaborative teams to work on projects and transmit their work amongst work group.

## Advantages and Disadvantages of P2P Networks

Advantages of P2P Networks
* It’s simple and easy to setup it requires only HUB or switches and RJ45 cables to connect all the computers together.
* File on the computer can be easily access on another computer if it set to shared folders.
* It’s cheap than having to use a server. The only cost involved is hardware, cabling and maintenance.
* The architecture of the layout is simple (how it connects)
* If one of the computers fails to work the other computers that connected will still be able to work.
* It doesn’t need any full time system administrator. Every user is basically their own administrator of their computers.
Disadvantages of P2P Networks
* The system is not centralized, thus administrating is difficult. You can’t determine the whole accessibility setting of others computer.
* Your network is vulnerable towards viruses, spywares, Trojans, etc.
* Data recovery is difficult and each computer should have its own back-up system.
* It’s only suitable for a small network that consist only 2-8 computers where high level security is not required. Not suitable for a business network that handle sensitive data.

## References

* All about Peer-to-peer architcture
* What is Peer-to peer
* Peer to Peer File Sharing
* Peer to peer by wiki