0% found this document useful (0 votes)
55 views121 pages

Transport Layer Overview and TCP Details

The document discusses the Transport Layer of communication networks, focusing on protocols such as TCP and UDP, and their responsibilities, services, and functionalities. It covers key concepts including connection management, addressing, TCP segment structure, flow control, and congestion management techniques. Additionally, it explains the use of sockets and various algorithms for efficient data transmission.

Uploaded by

Dheeraj Rao
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views121 pages

Transport Layer Overview and TCP Details

The document discusses the Transport Layer of communication networks, focusing on protocols such as TCP and UDP, and their responsibilities, services, and functionalities. It covers key concepts including connection management, addressing, TCP segment structure, flow control, and congestion management techniques. Additionally, it explains the use of sockets and various algorithms for efficient data transmission.

Uploaded by

Dheeraj Rao
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

2-Nov-24 Dr.

RAVILLA DILLI, ECE, MIT, Manipal, India


COMMUNICATION NETWORKS

Topics to be Discussed in the Section


Transport Layer: TCP, UDP
Application Layer: WWW, HTTP, SMTP, FTP, DNS

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 2


COMMUNICATION NETWORKS

Transport Layer:

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 3


COMMUNICATION NETWORKS

Transport Layer:
What are the responsibilities of Transport Layer ?

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 4


COMMUNICATION NETWORKS

Transport Layer:

Fig: The network, transport, and application layers.


Transport entity: The hardware and/or software within the transport layer
which makes use of N/W layer services.
It located in the operating system kernel.
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 5
COMMUNICATION NETWORKS

Transport Layer:
What are the similarities of Transport Layer & Network Layer ?
✓ Connection- Oriented Services
✓ Connectionless Services
✓ Addressing
✓ Flow Control
What is the necessity of Transport Layer(TL) ?
✓ A transport entity is informed halfway through a long transmission that its
N/W connection has been abruptly terminated .

✓ TL makes it possible for the transport service to be more reliable than the
underlying N/W service.

✓ Transport service primitives can be implemented as calls to library


procedures.(makes them independent of N/W service primitives)

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 6


COMMUNICATION NETWORKS

Transport Layer: Services

Figure: The nesting of TPDUs, packets, and frames.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 7


COMMUNICATION NETWORKS

Transport Layer: Services


TL Service vs N/W Layer Service ?
a) Services Provided to the Upper Layers
b) Transport Service Primitives
c) Berkeley Sockets
Transport layer provides a reliable service on top of an unreliable network.
Transport service must be convenient and easy to use.

Figure: The primitives for a simple transport service.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 8


COMMUNICATION NETWORKS
Transport Service Primitives
Transport Layer:

A state diagram for a simple connection management scheme. Transitions


labelled in italics are caused by packet arrivals. The solid lines show the client's
state sequence. The dashed lines show the server's state sequence.
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 9
COMMUNICATION NETWORKS

Transport Layer:
Berkeley Sockets(UNIX)

Fig: The socket primitives for TCP.


Socket: creates a new end point and allocates table space for it with in the
transport entity.
It specifies addressing format, type of service, and the protocol.
File descriptor is returned on successful execution of socket.
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 10
COMMUNICATION NETWORKS

Transport Layer: Addressing

Fig: Port numbers

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 15


COMMUNICATION NETWORKS

Transport Layer: Addressing

Fig: IP addresses versus port numbers

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 16


COMMUNICATION NETWORKS

Transport Layer: Addressing

Fig: Socket address


A combination of IP address and port address is called “Socket Address”.
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 17
COMMUNICATION NETWORKS
Transport Layer: TCP Services:

Fig: Stream delivery

Fig: Sending and receiving buffers


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 18
COMMUNICATION NETWORKS
TCP
Transport Layer:

Fig: TCP segments


The bytes of data being transferred in each connection are numbered by
TCP.
The numbering starts with a randomly generated number.
The value of the sequence number field in a segment defines the number
of the first data byte contained in that segment.
The value of the ACK field in a segment defines the number of the next
byte a party expects to receive. The ACK number is cumulative.
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 19
COMMUNICATION NETWORKS

Transport Layer: TCP


TCP connections are full-duplex and point-to-point.

TCP does not support multicasting or broadcasting.

TCP uses sliding window protocol for flow control.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 20


COMMUNICATION NETWORKS

Transport Layer: TCP

Figure: TCP segment format

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 21


COMMUNICATION NETWORKS

Transport Layer: TCP


Source and Destination port: identify the local end points of the connection.
( End point = IP address + Port address )

Sequence number: the byte numbers

ACK number: the next byte expected.

TCP header length: tells how many 32-bit words are present in the TCP
header.

6-bits: not used.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 22


COMMUNICATION NETWORKS

Transport Layer: TCP

Fig: Control field


Urgent Pointer: used to indicate a byte offset from the current sequence
number.
PSH: indicates pushed data. The Rx is requested to deliver data to the
application immediately after arrival.( do not buffer).
RST: used to reset a connection that has become confused due to a host
crash or some other reason.
SYN: used to establish the connections.
FIN: used to release the connections.
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 23
COMMUNICATION NETWORKS

Transport Layer: TCP


Check sum: used to provide extra reliability (Error control).

Options: used to provide extra facilities not covered by regular header.

specify the max. TCP payload it is willing to accept.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 24


COMMUNICATION NETWORKS

Transport Layer: TCP


Imagine a TCP connection is transferring a file of 6000 bytes. The first byte is
numbered 10010.
What are the sequence numbers for each segment if data are sent in five
segments with the first four segments carrying 1000 bytes and the last
segment carrying 2000 bytes?
The following shows the sequence number for each segment:
Segment 1 ==> sequence number: 10,010 (range: 10,010 to 11,009)
Segment 2 ==> sequence number: 11,010 (range: 11,010 to 12,009)
Segment 3 ==> sequence number: 12,010 (range: 12,010 to 13,009)
Segment 4 ==> sequence number: 13,010 (range: 13,010 to 14,009)
Segment 5 ==> sequence number: 14,010 (range: 14,010 to 16,009)

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 25


COMMUNICATION NETWORKS

Transport Layer: TCP

Figure: Three-step connection establishment


Step 1: Client sends SYN segment, contains source & Destination port numbers.
It also contains Initial Sequence Number (ISN) used for numbering the bytes of
data sent from the client to server.
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 26
COMMUNICATION NETWORKS

Transport Layer: TCP

Step 2: Server sends SYN and ACK segments.


ACK → acknowledges the first segment using ACK flag and
acknowledgement number field.

Server defines the client window size.

SYN → used as the initialization segment for the server.


Step 3: Client sends ACK segment. It acknowledges the second segment
using ACK flag and ACK number field.

Client defines the server window size.

Data can be sent with the 3rd packet.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 27


COMMUNICATION NETWORKS

Transport Layer: TCP

Fig: Four-step connection termination


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 28
COMMUNICATION NETWORKS

Transport Layer: TCP


Step 1: The client TCP sends the first segment, a FIN segment.

Step 2: Server sends ACK to confirm the receipt of the FIN segment from
the client.

Step 3: server TCP can continue sending data in the server-client direction.

When it finishes transmission, it sends FIN segment.

Step 4: client TCP sends ACK to confirm the receipt of the FIN from the TCP
server.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 29


COMMUNICATION NETWORKS

Transport Layer: TCP


Connection Resetting:

Case 1: TCP on one side has requested a connection to a nonexistent port.


Case 2: TCP may want to abort the connection due to an abnormal
situation.
Case 3: TCP on the one side may discover that the TCP on the other side
has been idle for a long time. It may send an RST segment to
destroy the connection.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 30


COMMUNICATION
TCP NETWORKS
Table: States for TCP
Transport Layer:

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 31


COMMUNICATION NETWORKS
TCP
Transport Layer:

Fig: State transition diagram


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 32
COMMUNICATION NETWORKS

Transport Layer: TCP


A sliding window is used to make transmission more efficient as well as to
control the flow of data so that the destination does not become
overwhelmed with data.

TCP’s sliding windows are byte-oriented.

Fig: Sender buffer

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 33


COMMUNICATION NETWORKS

Transport Layer:
TCP

Fig: Receiver window

Fig: Sender buffer and sender window

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 34


COMMUNICATION NETWORKS

Transport Layer:
TCP

Fig: Sliding the sender window

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 35


COMMUNICATION NETWORKS

Transport Layer:
TCP

Fig: Expanding the sender window

Fig: Shrinking the sender window


In TCP, the sender window size is totally controlled by the receiver window
value (the number of empty locations in the receiver buffer).

However, the actual window size can be smaller if there is congestion in the
network.
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 36
COMMUNICATION NETWORKS

Transport Layer: TCP

Fig: Lost segment


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 37
COMMUNICATION NETWORKS

Transport Layer: TCP

Fig: Lost acknowledgment

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 38


COMMUNICATION NETWORKS

Transport Layer: TCP

Fig: TCP timers


Retransmission Timer: Timer is set with 2 X RTT

1. If an ACK is received for a particular segment before timer goes off, the
timer is destroyed.

2. If the timer goes off before the ACK arrives, the segment is
retransmitted and the timer is set.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 39


COMMUNICATION NETWORKS

Transport Layer: TCP


Calculation of RTT:
Method 1: Use timestamp option.

Method 2. TCP uses start timer, and wait for ACK.

RTT = α (previous RTT) + (1 – α ) (current RTT)

Persistent Timer:
Zero Window size.

Deadlock condition.

Probe: Sender TCP sends 1-byte indicating the lost of ACK.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 40


COMMUNICATION NETWORKS

Transport Layer: TCP


Keep-alive: Used to prevent a long idle connection between two TCPs.

Time-waited Timer: Used during connection termination.

When TCP closes a connection, it does not consider the connection really
closed.

This allows duplicate FIN segments, if any, to arrive at the destination to be


discarded.

The timer is set with twice the expected lifetime of a segment.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 41


COMMUNICATION NETWORKS

Transmission Control Protocol (TCP):


TCP assumes that the cause of a lost segment is due to congestion in the
network.

If the cause of the lost segment is congestion, retransmission of the segment


does not remove the cause—it aggravates it.

Actual window size = min(Rx window size, Congestion window size)

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 42


COMMUNICATION NETWORKS

Transmission Control Protocol (TCP):


Congestion Avoidance: 1. Slow start and Additive increase

2. Multiplicative decrease

Figure: Multiplicative Decrease


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 43
COMMUNICATION NETWORKS

Transmission Control Protocol (TCP):

Figure: BECN(Backward Explicit Congestion Notification)

Figure: FECN(Forward Explicit Congestion Notification)


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 44
COMMUNICATION NETWORKS

Transmission Control Protocol (TCP):

Figure: Four cases of Congestion

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 45


COMMUNICATION NETWORKS

Transmission Control Protocol (TCP):

Figure: FIFO Queue

Figure: Priority Queue

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 46


COMMUNICATION NETWORKS

Transmission Control Protocol (TCP):

Figure: Weighted fair Queue

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 47


COMMUNICATION NETWORKS

Transmission Control Protocol (TCP):

Figure: Leaky Bucket

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 48


COMMUNICATION NETWORKS

Transmission Control Protocol (TCP):

Fig: Leaky Bucket Implementation

A leaky bucket algorithm shapes bursty traffic into fixed-rate traffic by


averaging the data rate.

It may drop the packets if the bucket is full.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 49


COMMUNICATION NETWORKS

Transmission Control Protocol (TCP):

Fig: Token Bucket

The token bucket allows bursty traffic at a regulated maximum rate.


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 50
COMMUNICATION NETWORKS

Transmission Control Protocol (TCP):


Silly Window Syndrome: Either or both sending TCP creates data slowly and
receiving TCP consumes data slowly.

Ex: 41/1 bytes

Syndrome created by the sender:

Solution: The sending TCP is forced to wait till it collects larger block of data.
How long it should wait ?

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 51


COMMUNICATION NETWORKS

Transmission Control Protocol (TCP):


Solution: Nagle’s Algorithm:

1. The sending TCP sends the first piece of data it receives from the sending
Application (even only 1 byte of data)

2. After sending 1st segment, sending TCP accumulates data in the o/p buffer
till either the receiving TCP sends ACK or to fill max. size of segment.

Now, TCP can send the next segment.

3. Step 2 is repeated for the rest of the transmission.

Segment size: Max. → application program is faster than the network

Min. → application program is slower than the network

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 52


COMMUNICATION NETWORKS

Transmission Control Protocol (TCP):


Syndrome created by the Receiver:
Clark’s Solution: Send ACK as soon as the data arrive, but to announce a
window size of zero until either there is enough space to accommodate a
segment of max. size or until ½ of the buffer is empty.

Delayed ACK Solution: Don’t send ACK immediately after receiving segments.

Send ACK after finding a sufficient amount of space in its incoming buffer.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 53


COMMUNICATION NETWORKS

User Datagram Protocol (UDP):


UDP is a connectionless, unreliable protocol that has no flow and little error
control.

It uses port numbers to multiplex data from the application layer.

Client: Ephemeral port number

Server : well-known port numbers

UDP packets are called “user datagrams”.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 54


COMMUNICATION NETWORKS

User Datagram Protocol (UDP):

Figure: Connection establishment

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 55


COMMUNICATION NETWORKS

User Datagram Protocol (UDP):

Figure: Connection termination

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 56


COMMUNICATION NETWORKS

User Datagram Protocol (UDP):

Figure: User datagram format


Checksum used to detect errors.

The calculation of checksum and its inclusion in the user datagram are
optional.

UDP is a convenient transport-layer protocol for multimedia applications.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 57


COMMUNICATION NETWORKS

User Datagram Protocol (UDP): Services:


Connectionless Services: User datagrams are independent even they are
belongs to same source.

Flow and Error Control : No Flow control(Rx may overflow with incoming
messages)

No error control except checksum.

Congestion Control : UDP does not provide congestion control.

Encapsulation and Decapsulation: When a process has a message to send


through UDP, it passes the message to UDP along with a pair of socket
addresses and the length of data.

UDP receives data and adds its header then passes to IP.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 58


COMMUNICATION NETWORKS

User Datagram Protocol (UDP): Services:


Queuing: If the outgoing queue can overflows, the OS can ask the client
process to wait before sending any more messages.
When a message arrives for a client, UDP checks to see if an incoming queue
has been created for the port number specified in the destination port
number field of the user datagram. If there is such a queue, UDP sends the
received user datagram to the end of the queue. If there is no such queue,
UDP discards the user datagram and asks the ICMP protocol to send a port
unreachable message to the server.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 59


COMMUNICATION NETWORKS

WWW: The WWW is a distributed client-server service, in which a client


using a browser can access a service using a server. The service provided is
distributed over many locations called sites.
HTTP is used to access data on the WWW.
The protocol transfers data in the form of plain text, hypertext, audio, video
etc.,

Figure: Architecture of WWW


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 60
COMMUNICATION NETWORKS
WWW:

Figure: Browser

Figure: URL (Uniform Resource Locator)

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 61


COMMUNICATION NETWORKS

WWW: The documents in the WWW can be grouped into three categories:
static, dynamic, and active.

The category is based on the time the contents of the document are
determined.

Figure: Static document Figure: Dynamic document using CGI

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 62


COMMUNICATION NETWORKS

WWW:

Figure: Dynamic document using server-site script

Dynamic documents are referred to as server-site dynamic documents.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 63


COMMUNICATION NETWORKS

WWW:

Figure: Active document using Java applet

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 64


COMMUNICATION NETWORKS

WWW:

Figure: Active document using client-site


script
Active documents are referred to as client-site dynamic documents.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 65


COMMUNICATION NETWORKS

HTTP (Hyper Text Transfer Protocol): It is a protocol used mainly to access


data on the World Wide Web.

HTTP functions like a combination of FTP and SMTP.

HTTP uses the services of TCP on well-known port 80.

Figure: HTTP transaction

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 66


COMMUNICATION NETWORKS

HTTP:

Figure: Request and response messages


Request Message: consists of a request line, a header, and sometimes body.
Request line: Consists of request type, resource(URL), and http version.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 67


COMMUNICATION NETWORKS

HTTP:

Figure: Request and status lines


URL: Method : // Host : Port / Path
Request Type(method) : is a protocol to retrieve the document. Ex: FTP, HTTP, etc.,
Host: is a computer where the information is located.
Port number(optional): port number of the server.
Path: Path name of the file where the information is located.
Version: HTTP is version is 1.1 (1.0, 0.9 are still in use)
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 68
COMMUNICATION NETWORKS

HTTP: Table: Methods

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 69


COMMUNICATION NETWORKS

HTTP: Table: Status codes

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 70


COMMUNICATION NETWORKS

HTTP: Table: Status codes (continued)

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 71


COMMUNICATION NETWORKS

HTTP:

Figure: Header format


Table: General headers

General Header: gives general information about the message and can be
present in both a request and a response.
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 72
COMMUNICATION NETWORKS

HTTP: Table: Request headers

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 73


COMMUNICATION NETWORKS

HTTP: Table: Response headers

Response Header: present only in a response message.

It specifies the server’s configuration and special information about the request.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 74


COMMUNICATION NETWORKS

HTTP: Table: Entity headers

Entity Header: gives information about the body of the document

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 75


COMMUNICATION NETWORKS

HTTP:

Figure: Example
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 76
COMMUNICATION NETWORKS

HTTP:

Figure: Example
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 77
COMMUNICATION NETWORKS

Simple Mail Transfer Protocol (SMTP):


Email is used for sending a single message that includes text, voice, video,
or graphics to one or more recipients.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 78


COMMUNICATION NETWORKS

SMTP:
Sending Mail: User creates mail that looks very similar to postal mail.
– Envelope: sender and receiver address
– Message:
• Header: Define the sender, receiver, subject of the message, ...
• Body: contains the actual information to be read by the recipient.

Receiving mail
– Email system periodically checks the mailboxes.
– If a user has mail, it informs the user with a notice
– If the user is ready to read the mail, a list is displayed in which each
line contains a summary of the information about a particular
message in the mailbox.
– Summary contains the sender mail address, the subject, and time the
mail was sent or received.
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 79
COMMUNICATION NETWORKS

SMTP:

Figure: Format of an email


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 80
COMMUNICATION NETWORKS

SMTP:
Email Address: Mail handling system must use an addressing system with
unique addresses.
• Local part: Name of a special file, called the user mailbox, where all the mail
received for a user is stored for retrieval by the user agent.
• Domain Name:
– Organization usually selects one or more hosts to receive and send
email; they are sometimes called mail exchangers.

– Domain name assigned to each mail exchanger either comes from the
DNS database or is a logical name (e.g., the name of the organization).

Figure : Email address

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 81


COMMUNICATION NETWORKS

SMTP:
First component of an electronic mail system is the user agent (UA); Mail
Reader.
Service provided by a UA:
– UA is a software program that composes, reads, replies to, and
forward messages.
– It also handles mailboxes.
– Composing messages:
• Responsible for composing the email message to be sent out.
• Some of them provide a template and some provide with built-in
editor; OR else user can type in an editor and paste into the user
agent.

Figure: User agent


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 82
COMMUNICATION NETWORKS

SMTP:
Reading messages:
– UA is used to read incoming messages.
– When a user invokes a UA, it first checks the mail in the incoming
mailbox. A one-line summary [number, flag field indicating if the mail
is new OR already read but not replied to OR read and replied to OR
…, size of message, sender, subject if subject line in message is not
empty] of each received mail is shown.

Replying to messages:
– After the reading a message, user can use the UA to reply to a
message.
– UA allows the user to reply to the original sender or to reply to all
recipients of the message.
– Reply contains the original message (for quick reference) and new
message.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 83


COMMUNICATION NETWORKS

SMTP:
Forwarding messages: Can forward with or without extra comments.

Handling Mailboxes:
– Inbox: Keeps all received emails until they are deleted by the user.
– Outbox: Keeps all sent emails until the user deletes them.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 84


COMMUNICATION NETWORKS

SMTP:
SMTP Can send messages only in 7-bit ASCII format.
Cannot be used to send binary files or video or audio.
Cannot support few languages that are not supported by ASCII
Multipurpose Internet Mail Extensions (MIME):
– Supplementary protocol that allows non-ASCII data to be sent
through SMTP.
– MIME transforms non-ASCII data at the sender side to ASCII data and
delivers them to client SMTP to sent through the Internet. Reverse is
done at the receiver side.

2-Nov-24 Figure: MIME


Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 85
COMMUNICATION NETWORKS

SMTP:
MIME defines five headers that can be added to original SMTP header:
MIME-Version
Content-Type: Type of data used in the body;
has subtypes separated with slashes.
Content-Transfer-Encoding
Content-Id: Uniquely identifies the whole message in a multiple-message
environment.
Content-Description: Whether the body is image, audio, or video.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 86


COMMUNICATION NETWORKS
Table: Data types and subtypes in MIME
SMTP:
Type Subtype Description
Text Plain Unformatted text; 7-bit ASCII
Mixed Body contains ordered parts of different data types
Parallel Same as above, but no order
Multipart
Digest Similar to mixed, but the default is message/RFC822
Alternative Parts are different versions of the same message
RFC822 Body is an encapsulated message
Message Partial Body is a fragment of a bigger message
Ext. Body Body is a reference to another message
JPEG Image is in JPEG
Image
GIF Video is in GIF format
Video MPEG Video is in MPEG format
Audio Basic Single-channel encoding of voice at 8 KHz
PostScript Adobe PostScript
Application
Octet-Stream General binary data (8-bit bytes)
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 87
COMMUNICATION NETWORKS

SMTP:
Table: Content-transfer encoding

Category Description

Type ASCII characters and short lines

7bit Non-ASCII characters and short lines

8bit Non-ASCII characters with unlimited-length lines

Binary 6-bit blocks of data are encoded into 8-bit ASCII characters

Non-ASCII characters are encoded as an equal sign followed by an ASCII


Base64
code

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 88


COMMUNICATION NETWORKS

SMTP:

Figure: Base64

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 89


COMMUNICATION NETWORKS
SMTP:
Mail Transfer Agent(MTA)(also called a mail server)is a computer program or
software agent which transfers Email messages from one computer to
another.

The MTA works behind the scenes, while the user usually interacts with
another program, the Mail User Agent (MUA), which contacts an MTA for
actual delivery of the mail.

Figure: MTA client and server


2-Nov-24 RAVILLA
Dr. DILLI
RAVILLA Faculty
DILLI, E & Manipal,
ECE, MIT, C Dept., MIT,
IndiaManipal 90
COMMUNICATION NETWORKS
SMTP:

Figure: MTA client and server


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 91
COMMUNICATION NETWORKS
SMTP:

When the sender and the receiver of an e-mail are on the same mail
server, we need only two user agents.

When the sender and the receiver of an e-mail are on different mail servers,
we need two UAs and a pair of MTAs (client and server).
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 92
COMMUNICATION NETWORKS
SMTP:

When the sender is connected to the mail server via a LAN or a WAN, we
need two UAs and two pairs of MTAs (client and server).

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 93


COMMUNICATION NETWORKS
SMTP:

When both sender and receiver are connected to the mail server via a LAN or a
WAN, we need two UAs, two pairs of MTAs (client and server), and a pair of
MAAs (client and server). This is the most common situation today.
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 94
COMMUNICATION NETWORKS
SMTP:

Figure: Message transfer


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 95
COMMUNICATION NETWORKS
SMTP:

SMTP uses commands and responses to transfer messages between an MTA


client and an MTA server.
Each command or reply is terminated by a two-character (carriage return
and line feed) end-of-line token.
Commands: Commands are sent from the client to the server.
Consists of a keyword followed by zero and more arguments.
SMTP defines 14 commands.
Responses: Responses are sent from server to client.
Response is a three-digit code that may be followed by additional
textual information.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 96


COMMUNICATION NETWORKS
SMTP:
Mail Transfer Phases:
Process of transferring a mail message occurs in three phases
1. Connection establishment
After a client has made a TCP connection to the well-known port
25, the SMTP server starts the connection phase.

2. Message transfer
After connection establishment, a single message between a
sender and one or more recipients can be exchanged.

3. Connection termination
After the message is transferred successfully, the client terminates
the connection.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 97


COMMUNICATION NETWORKS
SMTP:
Mail Delivery:
Delivery of email from sender to receiver consists of three stages
st
1 stage
• Email goes from user agent to local server
• Mail does not go directly to remote server because the remote
server may not be available at all times.
• Mail is stored in the local server until it can be sent.
2nd stage
• Email is relayed by local server, which now acts as the SMTP
client, to the remote server, which is the SMTP server.
• Email is delivered to remote server and not to the remote user
agent; Email is stored in mailbox of the user for later retrieval..
• Email server runs the SMTP server program.
3rd stage: Remote user agent uses a mail access protocol such as POP3
or IMAP4 to access the mailbox and obtain the mail.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 98


COMMUNICATION NETWORKS
SMTP:

Figure: Email delivery


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 99
COMMUNICATION NETWORKS
SMTP:
Mail access protocols:
SMTP is a push protocol; it pushes the message from the sender to the receiver
even if the receiver does not want it.

3rd stage needs a pull protocol; the operation must start with the recipient.

Mail must stay in the mail server mailbox until the recipient retrieves it.

POP3 [Post Office Protocol]:

Client POP3 software is installed on the recipient computer.

Server POP3 software is installed on the mail server.


• Client (user agent) opens a connection with the server on TCP port 110.
• It then sends its user name and password to access the mailbox.
• User can then list and receive mail messages, one by one.
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 100
COMMUNICATION NETWORKS
SMTP:

Figure: POP3
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 101
COMMUNICATION NETWORKS
SMTP:

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 102


COMMUNICATION NETWORKS

FTP (File Transfer Protocol):


Copying a file from one host to another

Problems in FTP
– Two systems may use different file name conventions
– Two systems may have different ways to represent text and data.
– Two systems may have different directory structures.
FTP is used to Copy a file from one host to another.

FTP provides compatibility between two computers that use


different OS,
different character set,
different file structures,
and different file formats.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 103


COMMUNICATION NETWORKS

FTP:
FTP uses the services of TCP. It needs two TCP connections.

The well-known port 21 is used for the control connection (commands and
response)
The well-known port 20 for the data connection (for data transfer).

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 104


COMMUNICATION NETWORKS

FTP:
Client has three components: User interface,
Client control process,
Client data transfer process.

Server has two components: Server control process,


Server data transfer process

• Control connection is made between control processes; Control connection


is maintained during entire interactive FTP session.

• Data connection is made between data transfer processes; Data connection


is opened & then closed for each file transferred.
2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 105
COMMUNICATION NETWORKS

FTP:
Control Connection:
– Created in same way as other application programs.
– Connection remains open during the entire process.
– Service type used by the IP is minimize delay, because this is an
interactive connection between a user (human) and a server.
– User types commands and expects to receive responses without
significant delay.

Figure : Using the control connection


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 106
COMMUNICATION NETWORKS

FTP:
Data connection:
Opened when data are ready to transfer. Closed when it is not needed.
Service type used by IP is maximize throughput.

Figure : Using the data connection

Communication over Data connection: To transfer file, client must define


file type,
data structure
and transmission mode

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 107


COMMUNICATION NETWORKS

FTP:
File Type: ASCII file

EBCDIC file (Extended Binary Coded Decimal Interchange Code )

Image file
Printability:
Non-print
TELNET (Terminal Emulation program for TCP/IP networks)

Data Structure: Transmission mode:

File Structure (default) Stream mode

Record Structure Block mode

Page Structure Compressed mode


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 108
COMMUNICATION NETWORKS

FTP:

Figure : File Transfer

Retrieving a file:
A file is to be copied from the server to the client.

Storing a file: A file is to be copied from the client to the server.

Retrieving a list: A list of directory or file names is to be sent from the server to
the client.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 109


COMMUNICATION NETWORKS

DNS in the Internet:


DNS maps the Domain names to an IP address.
Steps to map the host name to an IP Address:

1. The user passes the host name to the file transfer client.

2. The file transfer client passes the host name to the DNS client.

3. Each machine, after being booted, knows the address of one DNS server.

The DNS client sends a message to a DNS server with a query that gives the
file transfer server name using the known IP address of the DNS server.

4. The DNS server responds with the IP address of the desired file transfer
server.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 110


COMMUNICATION NETWORKS
DNS in the Internet
Steps to map the host name to an IP Address:

5. The DNS server passes the IP address to the file transfer client.

6. The file transfer client now uses the received IP address to access the
file transfer server.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 111


COMMUNICATION NETWORKS
DNS in the Internet
Name space: It maps each address to a unique name.

Flat Name space: Names in the space is a sequence of characters without


structure.

Hierarchical Name space: Each name is made of several parts.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 112


COMMUNICATION NETWORKS
Domain Name Space (DNS):

Domain Name Space: It is inverted tree structure with the root at the top.

The tree can have only 128 levels.( level 0 is root – level 127)

Label: Each node in the tree has a label. ( max. of 63-characters)


The root label is null string (empty string).

Full Domain Name: Name is a sequence of labels separated by dots(.)


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 113
COMMUNICATION NETWORKS
Domain Name Space (DNS): Domain Names and Labels

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 114


COMMUNICATION NETWORKS
Domain Name Space (DNS):

FQDN and PQDN

Fully Qualified Domain Name(FQDN): Label is terminated by a null string.

Partially Qualified Domain Name(PQDN): Label is not terminated by a null


string.

The resolver can supply the missing part(suffix) to create an FQDN.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 115


COMMUNICATION NETWORKS
Domain Name Space (DNS):
Hierarchy of Name Servers

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 116


COMMUNICATION NETWORKS
Domain Name Space (DNS):
DNS in the Internet

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 117


COMMUNICATION NETWORKS
Domain Name Space (DNS):
Generic Domains Generic domains define
registered hosts according to
their generic behavior.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 118


COMMUNICATION NETWORKS
Generic Domains
Domain Name Space (DNS):

Label Description

com Commercial organizations

edu Educational institutions

gov Government institutions

int International organizations

mil Military groups

net Network support centers

org Nonprofit organizations

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 119


COMMUNICATION NETWORKS
Domain Name Space (DNS): Generic Domains

Label Description

aero Airlines and aerospace companies

biz Businesses or firms (similar to com)

coop Cooperative business organizations

info Information service providers

museum Museums and other nonprofit organizations

name Personal names (individuals)

pro Professional individual organizations


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 120
COMMUNICATION NETWORKS
Country Domains
Country domains uses two-character country
abbreviations(eg., us for United States)

Second level can be more specific national designations.

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 121


COMMUNICATION NETWORKS
Domain Name Space (DNS):
Recursive Resolution

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 123


COMMUNICATION NETWORKS
Domain Name Space (DNS):
Iterative Resolution

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India 124


QUERIES ?

2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India


2-Nov-24 Dr. RAVILLA DILLI, ECE, MIT, Manipal, India

You might also like