CN Merged
CN Merged
CN Merged
The first component of an electronic mail system is the user agent (UA).
It provides service to the user to make the process of sending and receiving a message easier.
A user agent is a software package that perform.
The actual mail transfer is done through message transfer agents (MTA).
To send mail, a system must have the client MTA, and to receive mail, a system must have a server
MTA.
MESSAGE ACCESS AGENT (MAA)
MAA is a software that pulls messages out of a mailbox.
POP3 and IMAP4 are examples of MAA.
Format of an email
1. Mail is a text file
2. Envelope –
sender address,receiver address
3. Message –
a. Mail Header – defines the sender, the receiver, the subject of
the message, and other information
b. Mail Body – Contains the actual information in the message
SMTP OPERATIONS
Basic SMTP operation occurs in three phases:
1. Connection Setup
2. Mail Transfer
3. Connection Termination
Connection Setup
An SMTP sender will attempt to set up a TCP connection with a target host when it has one or more
mail messages to deliver to that host
Mail Transfer
Once a connection has been established, the SMTP sender may send one or more messages to the
SMTP receiver.
Connection Termination
Limitations in SMTP
Only uses NVT 7 bit ASCII format
How to represent other data types?
No authentication mechanisms
Messages are sent un-encrypted
Susceptible to misuse (Spamming,faking sender address)
MIME Protocol
MIME stands for Multipurpose Internet Mail Extensions. It is used to extend the
capabilities of Internet e-mail protocols such as SMTP.
Email system was designed to send messages only in ASCII format The MIME protocol
allows the users to exchange various types of digital content such as pictures, audio,
video, and various types of documents and files in the e-mail.
MIME is an e-mail extension protocol, i.e., it does not operate independently, but it
helps to extend the capabilities of e-mail in collaboration with other protocols such
as SMTP.
MIME is a protocol that converts non-ASCII data to 7-bit NVT(Network Virtual Terminal)
ASCII and vice-versa.
MIME HEADERS
Using headers, MIME describes the type of message content and the encoding used.
Headers defined in MIME are:
1. MIME-Version- current version, i.e., 1.1
2. Content-Type - message type (text/html, image/jpeg, application/pdf)
3. Content-Transfer-Encoding - message encoding scheme (eg base64).
4. Content-Id - unique identifier for the message.
5. Content-Description - describes type of the message body.
MIME CONTENT TYPES
There are seven different major types of content and a total of 14 subtypes.
In general, a content type specifies the type of data,
subtype specifies a particular format for that type of data.
MIME also defines a multipart type that says how a message carrying more than one data
type is structured.
One possible multipart subtype is mixed, which says that the message contains a set of
independent data pieces in a specified order
MIME has both base types (e.g., integers and floats) and compound types (e.g., structures and
arrays)
MIME Messages
• MIME information is contained in the mail header using standard
RFC 2822 format.
• MIME header specifies version, data type, encoding used to convert
the data to ASCII.
• Example:
• From: [email protected]
• To: [email protected]
• MIME-Version: 1.0
• Content-Type: image/jpeg
• Content-Transfer-Encoding: base64
• ..data for the image..
Pop vs IMAP
Similarities
Mail delivered to a shared, constanly connected server
New mail accessible anywhere in network on a variety of platforms
For access only, Need SMTP to send mail
Differences
POP simpler and more established (more clients and servers that
support it)
IMAP is stateful protocol with more features
TRANSMISSION CONTROL PROTOCOL (TCP)
Transmission Control Protocol (TCP) is probably the most widely used protocol.
It is a more sophisticated transport protocol is one that offers a reliable, connection-oriented, byte-
stream service.
TCP includes a flow-control mechanism for each of these byte streams that allow the receiver to limit
how much data the sender can transmit at a given time.
TCP also implements congestion-control mechanism. The idea of this mechanism is to prevent
sender from overloading the network.
Flow control is an end to end issue, whereas congestion control is concerned with how host and
network interact.
TCP is suited for applications that require high reliability, and transmission time is relatively less
critical.
TCP SERVICES
Process-to-Process Communication:
TCP provides process-to-process communication using port numbers.
Full-Duplex Communication: TCP offers full-duplex service, where data can flow in both directions
at the same time. Each TCP endpoint then has its own sending and receiving buffer, and segments
move in both directions.
Multiplexing and Demultiplexing:
TCP performs multiplexing at the sender and demultiplexing at the receiver.
Connection-Oriented Service :
TCP is a connection-oriented protocol.
When a process at site A wants to send to and receive data from another process at site B,
the following three phases occur:
Reliable Service :
TCP is a reliable transport protocol.
It uses an acknowledgment mechanism to check the safe and sound arrival of data.
TCP is a byte-oriented protocol, which means that the sender writes bytes into a TCP connection
and the receiver reads bytes out of the TCP connection.
TCP does not, itself, transmit individual bytes over the Internet.
TCP on the source host buffers enough bytes from the sending process to fill a reasonably sized
packet and then sends this packet to its peer on the destination host.
TCP on the destination host then empties the contents of the packet into a receive buffer, and the
receiving process reads from this buffer at its leisure.
All of the segments belonging to a message are then sent over this logical path.
Notice that while connection setup is an asymmetric activity (oneside does a passive open and the
other side does an active open),
Connection Establishment
While opening a TCP connection the two nodes(client and server) want to agree on a set of
parameters. ( The parameters are the starting sequence numbers )
1. Client sends a SYN segment to the server containing its initial sequence number
3. Finally, client responds with a segment that acknowledges server’s sequence num
Data Transfer
After connection is established, bidirectional data transfer can take place.
The client and server can send data and acknowledgments in both directions
Adaptive Retransmission
tcp dynamically adjust the retransmission timeout based on the observed round-trip time (RTT)
between the sender and receiver. This helps TCP adapt to changes in network conditions and ensures
efficient and reliable data delivery.
1. Record Time: When TCP sends a data segment, it records the current time.
2. Calculate SampleRTT: When an acknowledgment (ACK) for that segment arrives, TCP
calculates the SampleRTT by taking the difference between the current time and the
recorded time.
3. Update EstimatedRTT: TCP updates the EstimatedRTT using a weighted average of the
previous estimate and the new SampleRTT. The formula is
4. Compute Timeout: TCP then uses the EstimatedRTT to compute the retransmission timeout
(TimeOut) in a conservative way:
TimeOut = 2 × EstimatedRTT
Karn/Partridge Algorithm
• Whenever a segment is retransmitted and then an ACK arrives at the sender, it is impossible
to determine if this ACK should be associated with the first or the second transmission of the
segment for the purpose of measuring the sample RTT.
• It is necessary to know which transmission to associate it with so as to compute an accurate
SampleRTT. In the figure a: if you assume that the ACK is for the original transmission but it was
really for the second, then the SampleRTT is too large.
In the figure b: if you assume that the ACK is for the second transmission but it was actually for the
first then the SampleRTT is too small.
The solution is surprisingly simple. Whenever TCP retransmits a segment, it stops taking samples of
the RTT; it only measures SampleRTT for segments that have been sent only once. This solution is
known as the Karn/Partridge algorithm, after its inventors.
The main problem with the original computation is that it does not take the variance of the sample
RTTs into account.
if the variation among samples is small, then the EstimatedRTT can be better trusted and there is no
reason for multiplying this estimate by 2 to compute the timeout.
On the other hand, a large variance in the samples suggests that the timeout value should not be too
tightly coupled to the EstimatedRTT
In the new approach, the sender measures a new SampleRTT as before. It then folds this new sample
into the timeout calculation as follows:
TCP then computes the timeout value as a function of both EstimatedRTT and Deviation as follows:
TimeOut = µ × EstimatedRTT + φ × Deviation
where based on experience, µ is typically set to 1 and φ is set to 4. Thus, when the variance is small,
TimeOut is close to EstimatedRTT; a large variance causes the Deviation term to dominate the
calculation
TCP CONGESTION CONTROL
Congestion occurs if load (number of packets sent) is greater than capacity of the network (number
of packets a network can handle).
When load exceeds capacity, queues become full and the routers discard some packets and
throughput declines sharply.
When too many packets are contending for the same link
o Network is congested
Network should provide a congestion control mechanism to deal with such a situation.
2. Slow Start
Source increases CongestionWindow when level of congestion goes down and decreases the same
when level of congestion goes up.
TCP interprets timeouts as a sign of congestion and reduces the rate of transmission.
On timeout, source reduces its CongestionWindow by half, i.e., multiplicative decrease. For
example, if CongestionWindow = 16 packets, after timeout it is 8.
CongestionWindow += Increment
For example, when ACK arrives for 1 packet, 2 packets are sent. When ACK for both packets arrive,
3 packets are sent and so on.
Slow Start
Slow start is used to increase CongestionWindow exponentially from a cold start.
TCP doubles the number of packets sent every RTT on successful transmission.
When ACK arrives for first packet TCP adds 1 packet to CongestionWindow and sends two packets.
When two ACKs arrive, TCP increments CongestionWindow by 2 packets and sends four packets
and so on.
Instead of sending entire permissible packets at once (bursty traffic), packets are sent
Initially TCP has no idea about congestion, henceforth it increases CongestionWindow rapidly until
there is a timeout.
On timeout:
CongestionThreshold = CongestionWindow/ 2
CongestionWindow = 1
Slow start is repeated until CongestionWindow reaches CongestionThreshold and thereafter 1
packet per RTT.
Fast Retransmit And Fast Recovery
TCP timeouts led to long periods of time during which the connection went dead while waiting for
a timer to expire.
Fast retransmit is a heuristic approach that triggers retransmission of a dropped packet sooner
than the regular timeout mechanism. It does not replace regular timeouts.
When a packet arrives out of order, receiving TCP resends the same acknowledgment (duplicate
ACK) it sent last time.
When three duplicate ACK arrives at the sender, it infers that corresponding packet may be lost due
to congestion and retransmits that packet. This is called fast
When packet loss is detected using fast retransmit, the slow start phase is replaced by additive
increase, multiplicative decrease method. This is known as fast recovery.
Instead of setting CongestionWindow to one packet, this method uses the ACKs that are still in pipe
to clock the sending of packets.
Slow start is only used at the beginning of a connection and after regular timeout. At other times, it
follows a pure AIMD pattern.
For example, packets 1 and 2 are received whereas packet 3 gets lost.
1. PHYSICAL LAYER
The physical layer coordinates the functions required to transmit a bit stream over a
physical medium.
The physical layer is concerned with the following functions:
➢ Physical characteristics of interfaces and media - The physical layer defines
the characteristics of the interface between the devices and the transmission
medium.
➢ Representation of bits - To transmit the stream of bits, it must be encoded to
signals. The physical layer defines the type of encoding.
➢ Signals: It determines the type of the signal used for transmitting the information.
➢ Data Rate or Transmission rate - The number of bits sent each second –is also
defined by the physical layer.
➢ Synchronization of bits - The sender and receiver must be synchronized at the
bit level. Their clocks must be synchronized.
➢ Line Configuration - In a point-to-point configuration, two devices are
connected together through a dedicated link. In a multipoint configuration, a link
is shared between several devices.
➢ Physical Topology - The physical topology defines how devices are connected to
make a network. Devices can be connected using a mesh, bus, star or ring
topology.
➢ Transmission Mode - The physical layer also defines the direction of
transmission between two devices: simplex, half-duplex or full-duplex.
It is responsible for transmitting frames from one node to the next node.
The other responsibilities of this layer are
➢ Framing - Divides the stream of bits received into data units called frames.
➢ Physical addressing – If frames are to be distributed to different systems on the
network , data link layer adds a header to the frame to define the sender and
receiver.
➢ Flow control- If the rate at which the data are absorbed by the receiver is less
than the rate produced in the sender ,the Data link layer imposes a flow ctrl
mechanism.
➢ Error control- Used for detecting and retransmitting damaged or lost frames and
to prevent duplication of frames. This is achieved through a trailer added at the
end of the frame.
➢ Medium Access control -Used to determine which device has control over the
link at any given time.
3. NETWORK LAYER
This layer is responsible for the delivery of packets from source to destination.
It determines the best path to move data from source to the destination based on the
network conditions, the priority of service, and other factors.
The other responsibilities of this layer are
➢ Logical addressing - If a packet passes the network boundary, we need another
addressing system for source and destination called logical address. This
addressing is used to identify the device on the internet.
➢ Routing – Routing is the major component of the network layer, and it
determines the best optimal path out of the multiple paths from source to the
destination.
4. TRANSPORT LAYER
5. SESSION LAYER
7. APPLICATION LAYER
This layer enables the user to access the network. It handles issues such as network
transparency, resource allocation, etc. This allows the user to log on to remote user.
The other responsibilities of this layer are
➢ FTAM (File Transfer, Access, Management) - Allows user to access files in a
remote host.
➢ Mail services - Provides email forwarding and storage.
➢ Directory services - Provides database sources to access information about
various sources and objects.
Tcp architecture
TRANSPORT LAYER
▪ The transport layer is responsible for the reliability, flow control, and correction
of data which is being sent over the network.
▪ The two protocols used in the transport layer are User Datagram protocol and
Transmission control protocol.
o UDP – UDP provides connectionless service and end-to-end delivery of
transmission. It is an unreliable protocol as it discovers the errors but not
specify the error.
o TCP – TCP provides a full transport layer services to applications. TCP is
a reliable protocol as it detects the error and retransmits the damaged
frames.
INTERNET LAYER
▪ The network interface layer is the lowest layer of the TCP/IP model.
▪ This layer is the combination of the Physical layer and Data Link layer defined in
the OSI reference model.
▪ It defines how the data should be sent physically through the network.
▪ This layer is mainly responsible for the transmission of the data between two
devices on the same network.
▪ The functions carried out by this layer are encapsulating the IP datagram into
frames transmitted by the network and mapping of IP addresses into physical
addresses.
▪ The protocols used by this layer are Ethernet, token ring, FDDI, X.25, frame
relay.