Client-Server and Peer-to-Peer terms are often used in computer networks both are the network models that we use in our day-to-day life. The Client-Server model focuses on information sharing whereas, the Peer-to-Peer network model focuses on connectivity to remote computers. The detailed explanation of both models are the following:-
Client-Server Network Model
In the client-server network model, the device that is requesting the information is called a client and the device that is responding to the request is called a server. The Client-server processes are working in the application layer. The client device starts the connection by requesting data from the server, the server can either accept or reject the connection. If the connection is accepted, the server establishes and maintains a connection with the client over a specific protocol.
The protocols of the application layer explain the format of data exchange between clients and servers. The data exchange between the server and client may also require user authentication and the identification of a data file to be transferred.
The email server is one of the best examples of the client-server model which send, receive and store email. The client on a remote location issues a request to the email server for any mail to read. The server then replied by sending the requested email to the client. The data stream from the client to server is called upload and the data stream from server to client is called download. The figure below illustrates the email client-server Model
Other examples of servers are web servers, FTP servers, TFTP servers and Online multiplayer gaming servers. Every one of these servers provides resources to the client. Most servers have a one-to-many relationship with clients, meaning a single server can provide resources to multiple clients at one time.
Peer-to-Peer Network Model
Like the Client-Server Model, the peer-to-peer network model has no dedicated server; the data is directly accessed from a peer device without the use of a server. The P2P network model has the part: P2P networks and P2P applications. Both have the same features, but in practice, there are a little different.
In this model, two or more hosts are connected using a network and be capable of share resources such as printers and files without having a dedicated server. Each connected end device is known as a peer. The peer can work both as a server and a client. One host might suppose the role of server for one transaction at the same time as serving as a client for another. In the P2P networking model, the roles of client and server are set on a per request basis.
Due to P2P application devices in this model act both as a client and a server within the same communication; every client is a server and every server a client. The P2P applications need that each end device provides a user interface and run background P2P services.
The hybrid system is using many P2P applications. The hybrid system has decentralized resource sharing. The index database is stored in the directory server which is centralized. The index is the address to the resource location. Each peer gets access to the index server to get the location of a resource on another peer.
Common Peer-to-Peer (P2P) Applications
Every computer in the network running the P2P application can act both as a client and server for other computers in the network running the P2P application. Common P2P networks are the following:
Gnutella protocol also used in some P2P applications, where all user shares entire files with all other users. There are many Gnutella client applications are available, as well as gtk-Gnutella, Wireshark, Shareaza, and Bearshare.
A lot of P2P applications permit users to share pieces of many files with each other at the same time. Clients of this application use a small file called a torrent file to locate other users who have pieces that they need so that they can connect directly to them. This torrent also contains information about tracker computers that remain track of which users computers have what files. The torrent clients inquire for pieces from multiple users at the same time, recognized as a swarm. This is a BitTorrent technology. There are many BitTorrent clients as well as BitTorrent, uTorrent, Frostwire, and BitTorrent.
Sharing any type of file between users with the help of this P2P software, more files are copyright. Usage and distribution of these files without permission from the copyright holder is against the law. Copyright violation is an offence and results in criminal charges and civil lawsuits.