# data[].attributes.body
https://crosswordlabs.com/view/client-server-4

# data[].attributes.body
Web sockets allow a persistent connection between a server and a client.

Typically, you connect to the server, request the data, await the response, then disconnect. However, with a web socket the connection can remain open.

This allows both parties to communicate with each other at any time.

# data[].attributes.body
When connecting to a website, the server cannot send you data. You can only ask for data and it'll respond; it cannot ask you for data.

With a web socket, it can. This allows the server to update data when something changes. For example, you're working on Padlet and someone changes something, a server can tell every client that something changed and they can update the page.

This is possible without web sockets but it would require the client to constantly query the server for any changes.

# data[].attributes.attachment_caption
A man in a suit with a red tie, intrigued while reading a book

# data[].attributes.body
They connect through the TCP protocol. This protocol ensures that data is transferred successfully; without errors. I won't go into detail how this works.

The connection they form is called a "full-duplex socket". A socket is like a mailbox for a specific IP address (street name) and port (house number).

The duplex describes what type of "conversation" the parties can have. A full-duplex means that both parties can talk and respond. However, unlike half-duplex, both can talk at the same time.

# data[].attributes.body
An API, or an Application Programming Interface, allow different programs to interface, or communicate, with each other.

Web APIs are standardised with REST, Representational State Transfer, which uses HTTP request methods. It allows clients to talk to the server through HTTP. The API is hosted on the server.

# data[].attributes.body
What type of requests would you send to a server; what would you ask it to do? An acronym to remember this is CRUD: Create, Retrieve, Update, Delete.

CRUD allows us to map certain HTTP request methods to SQL functions:

Create: POST -> INSERT

Retrieve: GET -> SELECT

Update: PUT -> UPDATE

Delete: DELETE -> DELETE

# data[].attributes.body
The data sent to an API is encoded either within JSON (JavaScript Object Notation) or XML.

JSON has a very similar structure to Python dictionaries. I recommend you look at what those are, if you don't know. On the other hand, XML resembles HTML more

# data[].attributes.attachment_caption
A table to show the difference between JSON and XML

# data[].attributes.body
In a peer to peer network, all systems are directly connected to one another without a central server.

This way, instead of all data being stored on one server, the data is split between peers, and can be directly sent to one another instead of data being requested through a server.

# data[].attributes.body
Files can be transferred directly between peers, this allows for faster transfer than the client-server model, as it doesn't need to be transferred to the host first

Server system is not needed; can save cost.

Time does not need to be spent managing client permissions, as each peer is equal

# data[].attributes.body
Lacks security, no central server to identify possible threats when transferring files.

Each computer would need a backup system in order to restore files, rather than one backup system on a server

Difficult to administrate whole system when no there's no central server.

# data[].attributes.body
Peer-to-Peer networks are used in a varity of different situations. Peer-to-Peer networks allow the sharing of files between peers without the need of a central authority to judge what files are allowed or disallowed.

Peer-to-Peer networking is used in sitatuons such as Online gaming, Large file sharing and distributed computing.

In the case of Online gaming,
Multiplayer games often use Peer-to-Peer networking for real time communication between players as it provides much more stable and efficent connections than client server newtorking.

In the case of Large File Sharing,
It is much faster and easier to share large files by the use of a Peer-to-Peer network as it does not involve the longer process of a central authority checking over the files.

In the case of Distributed Computing,
Peer-to-Peer networks can be used to distribute computing tasks among peers. This allows for large computations to be performed in parallel and reducing the workload on a single central server

# data[].attributes.body
A client requests data while a server provides that data.

# data[].attributes.body
In a client-server network, all of the clients connect to a central server(s). Clients are not connected to each other, instead they could communicate with each other through the server.

The clients can communicate to the server through any network, either a Local Area Network or a Wide Area Internet; which includes the Internet.

# data[].attributes.headline
Advantages of using a client-server architecture

# data[].attributes.subject
Advantages of using a client-server architecture

# data[].attributes.body
The main benefit of using a client server architecture is security. The server controls everything and clients cannot communicate with each other. This means that clients will not have access to access-controlled resources and can't send malicious data to other clients.

For example, if using a peer-to-peer architecture for a game, this allows peers to grab each others' IP addresses and DDoS them; resulting in them unable to access the Internet.

Another benefit is their ability to be scaled up. You can easily grow the amount of servers and clients connect to the server with the most availability. This can be done as this architecture is centralised.

# data[].attributes.headline
Disadvantages of using a client server architecture

# data[].attributes.subject
Disadvantages of using a client server architecture

# data[].attributes.body
However, the servers can be overloaded with requests. Imagine trying to speak to more than 2 people at once, each asking a question and demanding your attention - it gets hard to do so.

Overloading can be reduced by using a 'load balancer' which redirects requests to different servers. For example, if a server is at 50%, another at 25%, aim to get them both the same amount.

Another huge disadvantage is cost. You need money to host the servers and this increases drastically with the amount of people and requests to your servers.

For example, a basic "bare metal" dedicated server can start at around £100+ a month. Large companies like Amazon have thousands of servers around the world, a lot larger than these basic ones.

# data[].attributes.body
Stefan

Client-server: file server, mail server, game server

Peer-to-peer: torrenting, cryptocurrencies, tor

# data[].attributes.body
Client networks are commonly used in organisational sitations such as universities, schools, and large businesses.

Users of a client network usually have a need/ access to things such as:
- Private File Storage
- Shared File Storage
- Organisational Internet
- Hardware peripherals such as printers or scanners.

In the case of a secondary school, it would allow students and teachers to have a frequently backed up personal file storage that allows the permissions to create, delete and view files as well as the permissions to access the internet and peripherals avalible at the school.
Students would have no way to delete files on the shared teacher file storage whilst the teachers would have a easy way to share teaching resources with students and teachers alike.

# data[].attributes.body
https://crosswordlabs.com/view/peer-to-peer-4

# data[].attributes.attachment_link.description
difficult to recover on p2p; advantage of no central server; something p2p networks can lack; can be transferred between peers; all peers same permissions; computer in a p2p network; not needed in a p2p network