14.1 Protocol Notes by EMK 2024
14.1 Protocol Notes by EMK 2024
1 Protocols Notes
Objective:
Show understanding of why a protocol is essential for communication between computers
Show understanding of how protocol implementation can be viewed as a stack, where each
layer has its own functionality.
Show understanding of the TCP/IP protocol suite. Four Layers (Application, Transport,
Internet, Link) Purpose and function of each layer. Application when a message is sent from
one host to another on the internet.
Show understanding of protocols (HTTP, FTP, POP3, IMAP, SMTP, Bit Torrent) and their
purposes. Bit Torrent protocol provides peer-to-peer file sharing.
Protocol
It is a set of rules for data transmission which are agreed by sender and receiver for
successful transmission of data over a network.
A protocol is essential for communication between computers because it establishes a
standardized set of rules, conventions, and procedures that enable consistent and reliable
data exchange. Without protocols, computers wouldn't be able to understand each other's
messages, leading to disordered and ineffective communication.
There are many protocols, each defining rules for specific communication types.
• Protocol Stack
A Protocol Suite is collection of related protocols. For a protocol suite, protocols can be
viewed as layers within a protocol stack.
➢ Each layer can only accept input from next higher layer or next lower layer.
➢ There is a defined interface between adjacent layers which constitutes only
interaction allowed between layers.
➢ A layer is serviced by the actions of lower layers.
➢ Except for the bottom layer, each layer's job is made by software it has installed.
➢ A layer may comprise sub-layers.
➢ Any user interaction will take place using protocols associated with highest level layer
in stack.
➢ Any direct access to hardware is confined to lowest layer in the stack.
TCP/IP Protocol Suite TCP/IP is dominant protocol suite for Internet usage.
➢ TCP – Transmission Control Protocol: TCP is responsible for breaking data down into
small packets before they can be sent over a network, and for assembling the packets
again when they arrive.
➢ IP – Internet Protocol: IP takes care of communication between computers. It is
responsible for addressing, sending and receiving the data packets over the Internet.
Using layers breaks down process into manageable self-contained modules, making it easier
to develop and easier to make software and hardware compatible. This process is known as
Decomposition. Each of layers is implemented using software.
When Sending Data across internet (network), layers are used in order layer 4 to layer 1.
When Receiving Data across internet (network), layers are used in order layer 1 to layer 4.
Application Layer
It is top layer of TCP/IP. Application layer contains all programs that
exchange data, such as web browsers or server software. It sends files to transport layer.
This layer allows applications to access services used in other layers and also defines
protocols that any app uses to allow exchange of data.
Protocols Associated with Application Layer:
Hypertext transfer protocol (HTTP):
HTTP is most important application layer protocol. Essentially, this protocol underpins the
world wide web. It is used when fetching an HTML document from a web server.
HTTP is a client/server protocol: request messages are sent out to web servers which then
respond. HTTP protocols define format of messages sent and received. Web browser (which
is part of application layer) initiates web page request and also converts HTML into a format
which can be displayed on user’s screen or can be played through their media player.
What happens when a user requests a web page from a website?
Ans:
➢ User keys the URL into their browser.
➢ HTTP(s) transmits request from application layer to transport layer.
➢ TCP creates data packets and sends them (via port 80) to destination port.
➢ DNS server stores a database of URLs and matching IP addresses.
➢ DNS server uses domain name typed into browser to look up IP address of website.
➢ Server TCP sends back an acknowledgement.
➢ Once communication has been established, web server sends web page back in
HTML format to browser.
➢ Browser interprets page and displays it or sends data to media player.
File Transfer Protocol (FTP)
FTP is the application-layer protocol that can handle any
file transfer between two end-systems. File transfer is not simple if the end-systems
have different operating systems with different file systems. FTP handles this by
separating the control process from the data-transfer process.
Additional Features of FTP:
➢ Anonymous FTP: This allows a user to access files without need to identify who they
are to the FTP server.
➢ FTP Commands: A user is able to carry out actions that can change files stored on FTP
server.
➢ FTP Server: FTP (File Transfer Protocol) server is a type of computer program or
software that allows you to transfer files between computers over a network. It acts as
a central hub for storing and sharing files, and it provides a way for users to upload,
download, and manage files from remote locations. FTP servers are commonly used for
tasks like website maintenance, sharing large files, and managing files on a remote
server.
Simple Mail Transfer Protocol (SMTP):
SMTP is text-based and connection-based protocol used when sending
emails. It is referred to as a push protocol because a client opens a connection to a server
and keeps connection active all time; client then uploads a new email to server.
As SMTP is text-based only, it doesn’t handle binary files (binary file is a file containing
media/images as well as text).
If an email contains attachments made up of images, video, music then it is necessary to use
multi-purpose internet mail extension (MIME) protocol instead. MIME header is used at
beginning of transmission. Clients use this header to select which media player is needed
when attachment is opened.
POP3/4 and IMAP
Post office protocol (POP3/4) and internet message access protocol
(IMAP) are protocols used when receiving emails from email server. These are known as pull
protocols (Client periodically connects to a server; checks for and downloads new emails
from server – connection is then closed. This process is repeated to ensure client is updated).
IMAP is a more recent protocol than POP3/4, but both have really been superseded by
increasing use of HTTP protocols. However, SMTP is still used when transferring emails between
email servers.
Main difference between POP3/4 and IMAP is synchronization.
Difference Between POP3/4 and IMAP
Post Office Protocol (POP3/4) Internet Message Access Protocol (IMAP)
POP3/4 does not keep server and client in IMAP keeps server and client in
synchronization. When emails are synchronization. Only a copy of email is
downloaded by client, they are then deleted downloaded with original remaining on the
from server which means it is not further server until the client manually deletes it.
updated.
Transport Layer
Transport layer regulates network connections; this is where data is
broken up into packets which are then sent to the internet/network layer (IP protocol).
Transport layer ensures that packets arrive in sequence, without errors, by swapping
acknowledgements and retransmitting packets if they become lost or corrupted.
Protocols associated with Transport Layer:
➢ UDP (User Datagram Protocol) provides simpler but unreliable service by sending
packets from one host to another.
Example while streaming a video; loss of few bytes of information is acceptable as this
does not harm the user experience much.
➢ TCP (Transmission Control Protocol) is responsible for safe delivery of message to
receiver. TCP protocol creates sufficient packets to hold all of data. Each packet consists
of a header plus user data. It uses positive acknowledgement with re-transmission (PAR)
which means it automatically re-sends a data packet if it has not received a positive
acknowledgement.
TCP protocol is connection-oriented. Initially one packet of sequence is sent to network
layer. Once network layer returns acknowledgement to Transport layer indicating that
connection has been established, TCP sends other packets and receives response packets
containing acknowledgement. This allows missing packets to be identified
and re-sent.
Messages are split up into small groups of bits called packets (example, a web page would
be split up into number of packets before sending over network).
Router is used to transmit packets of data; routers contain connections to many other
routers; when packets arrive at a router it decides where next to send them.
Packets are known as frames at data-link layer, datagrams at internet layer and segments
at transport layer. Different names are used as each layer adds its own header to packet.
IP packet, which is called a 'datagram', is sent to data-link layer. Data-link layer assembles
datagrams into 'frames'. At this stage, transmission can begin. Once the IP packet has been
sent to the data-link layer, IP has no further duty. IP functions as a connectionless service. If
IP receives a packet which contains an acknowledgement of a previously sent packet, it will
simply pass the packet on to TCP with no awareness of the content.
Router:
Frame sent by data- link layer will arrive at a router during transmission (more likely
at several routers). At this stage, the datagram content of the frame is given back to IP. It is
now the function of the router software to choose the next target host in the transmission.
The software has access to a routing table appropriate to that router. IP then passes the
datagram back to the data-link layer at the router.
A further point to note here is that when a frame arrives at a switch, it is transmitted on
without any routing decision.
Sub-layers of Ethernet:
Logical Link Control (LCC) protocol is responsible for interaction with Network layer. It
manages data transmissions and ensures integrity of data transmissions. However,
because Ethernet is a connectionless protocol it has no responsibility for checking that
a transmission has been successfully delivered.
Medium Access Control (MAC) protocol is responsible for assembling Ethernet packet
which is referred to as a frame. Two components of
this are address of the transmitter and address of
receiver. In addition the MAC protocol initiates frame
transmission and handles recovery from transmission
failure due to a collision (using CSMA/CD).
Physical Coding Sublayer (PCS) protocol is
responsible for coding data ready for transmission or
decoding data received. It either receives a frame
from the MAC protocol or sends one to it.
Physical Medium Attachment (PMA) protocol is
responsible for signal transmitting and receiving.
CSMA/CA uses Distributed Control Function (DCF) to ensure a WiFi device can only transmit
when there is a free channel available. Since all transmissions are acknowledged when using
DCF, if a device does not receive an acknowledgement it will assume a collision will occur
and waits for a random time interval before trying again. This is an important protocol to
ensure the security and integrity of data being sent over a wireless network (WLAN).
Bluetooth Protocols
It uses the standard IEEE 802.15 protocol for short-range data
transmission/communication. Bluetooth use electromagnetic radiation as carrier of data
transmission. Bluetooth sends and receives radio waves in a band of 79 different frequencies
(channels). Devices using Bluetooth automatically detect and connect to each other, but they
do not interfere with other devices since each communicating pair uses a different channel
(from 79 options). When a device wants to communicate, it picks one of 79 channels at
random. If channel is already being used, it randomly picks another channel. This is known as
Spread Spectrum Frequency Hopping.
Peer-To-Peer File Sharing / Bit Torrent Protocol
BitTorrent is a protocol which is based on Peer-to-Peer networking concept. This allows very
fast sharing of files between computers (known as peers).
While Peer-To-Peer Networks only work well with very small numbers of computers, concept
of sharing files using BitTorrent can be used by thousands of users who connect together
over the internet. Because user computers are sharing files directly with each other rather
than using a web server. Main difference is that the BitTorrent protocol allows many
computers acting as peers to share files.
Suppose computer ‘A’ wishes to share a file with a number of other interested peers. How
can we use the BitTorrent protocol to allow this file sharing?
Solution:
Initially, to share a file, peer (computer ‘A’) creates a small file called a torrent.
Torrent contains metadata about file that is going to be shared. Actual file is broken up into
equal segments known as pieces (typically a 20 MiB file may be broken up into 20 × 1 MiB
pieces). Other peers who wish to download this file must first obtain torrent and connect
appropriate tracker which is a central server that contains data about all of computers
connected to it.
As each peer receives a piece of file they then become a source for that piece of file. Other
peers connected to tracker will know where to find the piece of file they need.
Once a peer has downloaded a file completely and they make file available to other peers in
the swarm (group of peers connected together), they become a seed. More seeds in the
swarm, faster the file downloading process between peers.
Logging off once the full file download has been completed is frowned upon by swarm
community; such a peer is termed a leech.
Note that file pieces may not be downloaded sequentially and have to be rearranged in
the correct order by the BitTorrent protocol to produce the final file.
Lurker is a peer that downloads many files but does not make available any new content for
community as a whole.
Leech is a peer that has a negative impact on the swarm by having a poor share ratio, that
is, they are downloading much more data than they are uploading to the others.
Tracker is central server that stores details about other computers that make up swarm; it
will store details about all peers downloading or uploading file, allowing peers to locate each
other using stored IP addresses.
***********