2. What is a protocol? 🤔
⬥ A protocol is a set of rules that govern all
aspects of communication between two or more
partners, called peers.
⬥ These rules are human-made
2
3. What is a protocol?
⬥ These rules regulate the following characteristics of a
network:
a. Access method
b. Allowed physical topologies*
c. Types of cabling
d. Speed of data transfer
* Network topology is the arrangement of the elements of a network
3
4. What is the purpose of protocols?
⬥ They allow connected devices to communicate
with each other, regardless of any differences in
their internal processes, structure or design.
4
5. Who makes protocols?
⬥ Standardization committees
⬥ Designers of a new distributed application
5
6. What are the common types of protocols?
1. Transmission Control Protocol (TCP)
2. User Datagram Protocol (UDP)
3. Internet Control Message Protocol (ICMP)
4. Hypertext Transfer Protocol (HTTP)
6
7. 1. Transmission Control Protocol (TCP)
⬥ TCP is a connection-oriented protocol, which
means a connection is established and
maintained until the application programs at
each end have finished exchanging messages.
7
8. What is TCP used for?
⬥ TCP is used for organizing data in a way that
ensures the secure transmission between the
server and client
8
9. What is TCP used for?...
⬥ It is used to transmit data from other higher-level
protocols that require all transmitted data to arrive
for example:
⬥ SSH – another network protocol that gives users,
particularly system administrators, a secure way to
access a computer over an unsecured network.
⬥ SMTP (Simple Mail Transfer Protocol) - used in sending
and receiving e-mail
⬥ HTTP (we will talk about this in a moment)
9
10. Why is TCP important?
⬥ Ensures that data transmission is carried out
uniformly, regardless of the location, hardware or
software involved
⬥ it is flexible and highly scalable (new protocols can be
introduced to it and it will accommodate them)
⬥ It is nonproprietary - no one person or company owns
it.
10
11. How does TCP work? (Connection establishment)
1. The client sends a SYN packet or segment (SYN stands for
synchronize) with a unique, random number to the server.
This number ensures full transmission in the correct order
(without duplicates).
2. 2. If the server has received the segment, it agrees to the
connection by returning a SYN-ACK packet (ACK stands for
acknowledgment) including the client's sequence number
plus 1. It also transmits its own sequence number to the
client.
11
12. How does TCP work?...
1. Finally, the client acknowledges the receipt of the SYN-
ACK segment by sending its own ACK packet, which in this
case contains the server's sequence number plus 1. At the
same time, the client can already begin transferring data
to the server.
12
14. How does TCP work?... (Connection termination)
1. The client sends a FIN segment to notify the server that it
no longer wants to send data. It sends its own sequence
number, just as it does when the connection is established.
2. The server acknowledges receipt of the package with an
ACK segment that contains the sequence number plus 1.
3. When the server has finished the data transfer, it also
sends a FIN packet, to which it adds its sequence number.
4. Now the client sends an ACK packet including the
sequence number plus 1, which officially terminates the
TCP connection for the server. 14
15. How does TCP work?... (Connection termination)
15
16. 2. User Datagram Protocol (UDP)
It is a communications protocol that is primarily used for
establishing low-latency and loss-tolerating connections
between applications on the internet
It speeds up transmissions by enabling the transfer of data
before an agreement is provided by the receiving party
16
17. What are the differences between UDP and
TCP?
17
18. What are the differences between UDP and
TCP?
18
19. How can UDP be used in a DDoS attack?
19
Since UDP does not require a handshake, attackers can ‘flood’
a targeted server with UDP traffic without first getting that
server’s permission to begin communication.
This forces the target to respond with an equally large number
of ICMP (we will talk about these next) packets, which indicate
those ports were unreachable. The computing resources
required to respond to each fraudulent datagram can exhaust
the target, resulting in a denial-of-service to legitimate traffic.
20. 3. Internet Control Message Protocol (ICMP)
20
⬥ It is an error-reporting protocol network that devices like
routers use to generate error messages to the source IP
address when network problems prevent delivery of IP
packets.
⬥ ICMP is mainly used to determine whether or not data is
reaching its intended destination in a timely manner.
21. What is ICMP used for?
21
1. Error reporting
When two devices connect over the Internet, the ICMP
generates errors to share with the sending device in the event
that any of the data did not get to its intended destination.
For example, if a packet of data is too large for a router, the
router will drop the packet and send an ICMP message back to
the original source for the data.
22. What is ICMP used for?
22
2. Network diagnostics
⬥ The commonly used terminal utilities traceroute and ping
both operate using ICMP.
⬥ Traceroute – It is used to display the routing path between
two Internet devices. A traceroute reports the time
required for each hop along the way, useful for
determining sources of network delay.
⬥ Ping - A ping will test the speed of the connection
between two devices and report exactly how long it takes a
packet of data to reach its destination
23. How does ICMP work?
23
⬥ ICMP is not associated with a transport layer protocol such
as TCP or UDP.
⬥ This makes ICMP a connectionless protocol ( one device
does not need to open a connection with another device
before sending an ICMP message.)
25. 4. Hypertext Transfer Protocol (HTTP)
25
⬥ Is used to load web pages using hypertext links.
⬥ HTTP is an application layer protocol designed to transfer
information between networked devices
⬥ A typical flow over HTTP involves a client(machine) making
a request to a server, which then sends a response
message.
⬥ What are the examples in Be.Well?
26. What’s in an HTTP request?
26
⬥ An HTTP request is a way internet communications
platforms such as web browsers ask for the information
they need to load a website
⬥ Each HTTP request carries a series of encoded data that
carries different types of information. A typical HTTP
request contains:
⬦ HTTP version type, a URL, an HTTP method, HTTP
request headers and an optional HTTP body.
27. What is an HTTP method? 🤔
27
An HTTP method indicates the action that the HTTP request
expects from the queried server e.g POST, GET, PUT, PATCH…
Question: What is the difference between PUT and PATCH?*
*A front end dev should answer this first… then a backend dev to blow us
away with knowledge
28. What are HTTP request headers?
28
⬥ HTTP headers contain text information stored in key-value
pairs
⬥ They are included in every HTTP request and response
⬥ These headers communicate core information, such as
what browser the client is using what data is being
requested, etc.
Open Google Search in chrome and inspect
29. What’s in an HTTP request body?
29
⬥ The body of an HTTP request contains any information
being submitted to the web server, such as a username
and password, or any other data entered into a form.
⬥ Open our Be.Well Pro Readme and inspect
30. Evolution of HTTP
30
HTTP has four versions
1. HTTP/0.9
2. HTTP/1.0
3. HTTP/1.1
4. HTTP/2.0.
Today the version in common use is HTTP/1.1 and the future
will be HTTP/2.0.
31. 1. HTTP/0.9 — The One-line Protocol
31
⬥ The initial version of HTTP — a simple client-server, request-
response, telenet-friendly protocol
⬥ Request nature: single-line (method + path for requested
document)
⬥ Methods supported: GET only
⬥ Response type: hypertext only
⬥ Connection nature: terminated immediately after the
response
⬥ No HTTP headers (cannot transfer other content type files),
No status/error codes, No URLs, No versioning
33. 2. HTTP/1.0 — Building extensibility
33
⬥ Browser-friendly protocol
⬥ Provided header fields including rich metadata about both
request and response (HTTP version number, status code,
content type, etc.)
⬥ Response: not limited to hypertext (Content-Type header
provided ability to transmit files other than plain HTML files
— e.g. scripts, stylesheets, media)
⬥ Methods supported: GET, HEAD, POST
⬥ Connection nature: terminated immediately after the
response
34. What was the problem with HTTP/0.9 and HTTP/1.0?
34
⬥ Both HTTP/0.9 and HTTP/1.0 required to open up a new
connection for each request (and close it immediately
after the response was sent).
⬥ Each time a new connection establishes, a TCP three-way
handshake should also occur.
⬥ For better performance, it was crucial to reduce these
round-trips between client and server.
Enter HTTP/1.1, which solved this with persistent connections.
35. 3. HTTP/1.1 — The standardized protocol
35
Introduced critical performance optimizations and feature
enhancements such as:
⬥ persistent and pipelined connections => faster response
⬥ chunked transfers by compression/decompression
⬥ virtual hosting (a server with a single IP Address hosting
multiple domains)
⬥ great bandwidth savings by adding cache support.
Methods supported: GET, HEAD, POST, PUT, DELETE, TRACE,
OPTIONS
Connection nature: long-lived
36. 4. HTTPS
36
⬥ HyperText Transfer Protocol Secure (HTTPS) is the secure
version of HTTP.
⬥ It uses SSL/TLS for secure encrypted communications.
⬥ An HTTPS connection can protect the data transfer from:
a. Man-in-the-middle attacks and
b. Common security threats by providing bidirectional
encryption for communications between a client and
server.
37. What is the problem with HTTPS?
37
⬥ It normally costs 1–2 seconds and drastically slows down
the startup performance of a website.
⬥ This is because of the time taken to establish the SSL/TLS
handshake process for secure connections
38. 5. HTTP/2.0 and the future
38
⬥ Modern enhancements like HTTP/2.0, Server Side Events
(SSE), and Websockets have changed the way that the
traditional HTTP works
39. What is HTTP polling?
39
⬥ HTTP polling is a method where the client polls the server
requesting new information
40. What are the methods of HTTP polling?
40
1. HTTP Short Polling
2. HTTP Long Polling
3. HTTP Periodic Polling
4. HTTP Streaming
5. SSE (Server-Sent Events / EventSource)
6. HTTP/2 Server Push
7. WebSockets
41. 1. HTTP Short Polling
41
⬥ A lot of requests are processed as they come to the server,
creating a lot of traffic
⬥ Uses resources, but frees them as soon as the response is
sent back
Problem: Its bad if you need to be notified WHEN the server
event happens with no delay
42. 2. HTTP Long Polling
42
⬥ One request goes to the server and the client is waiting for
the response to come. The server holds the request open
until new data is available (it’s unresolved and resources
are blocked)
Problem: It is more complex and more server resources used
43. 3. HTTP Periodic Polling
43
⬥ There’s a predefined time gap between two requests.
⬥ This is an improved/managed version of polling. You can
reduce server consumption by increasing the time gap
between two requests
44. 4. HTTP Streaming
44
⬥ The client makes an HTTP request, and the server trickles
out a response of indefinite length (it’s like polling
infinitely)
Problem: Intermediaries can interrupt the connection (e.g.
timeouts)
45. 5. SSE (Server-Sent Events / EventSource)
45
⬥ Communication is carried out from server to browser only
⬥ Browsers can only subscribe to data updates originated by
the server, but cannot send any data to the server
Sample applications: Updates when the test results are ready
in Be.Well
46. 6. HTTP/2 Server Push
46
⬥ a server to proactively push assets (stylesheets, scripts,
media) to the client cache in advance
Sample applications: Social media feeds, single-page apps
Sample applications: Updates when the test results are ready
in Be.Well
47. 6. HTTP/2 Server Push… Problems
47
⬥ Intermediaries (proxies, routers, hosts) can choose not to
properly push information to the client as intended by the
origin server.
⬥ Connections aren’t kept open indefinitely. A connection
can be closed anytime even when the content pushing
process happens. Once closed and opened again, this
connection cannot continue from where it left.
⬥ Some browsers/intermediaries don’t support Server Push
48. 7. WebSockets
48
⬥ WebSockets allow both the server and the client to push
messages at any time without any relation to a previous
request
“Websockets take polling out of the equation”
50. WebSockets solve a few issues with HTTP:
50
⬥ Bi-directional protocol — either client/server can send a
message to the other party. HTTP is a unidirectional
protocol
⬥ Full-duplex communication — client and server can talk to
each other independently at the same time.
⬥ Single TCP connection — After upgrading the HTTP
connection, in the beginning, the client and server
communicate over that same TCP connection throughout
the lifecycle of WebSocket connection.
51. References
51
1. Evolution of HTTP
2. What is ICMP?
3. What is HTTP?
4. What is a DDoS attack?
5. Definition of ICMP by Search Networking
6. PUT vs PATCH (What's the Difference?)