You are on page 1of 20

UNIT - V

TRANSPORT LAYER
 The main role of the transport layer is to provide the communication services directly to the application
processes running on different hosts.
 Example of transport layer protocols are: TCP and UDP.

TRANSPORT SERVICE
1. WRITE ABOUT TRANSPORT LAYER SERVICES. (PART - C)
2. WRITE SHORT NOTES ON SERVICES PROVIDED TO THE UPPER LAYER BY TRANSPORT
LAYER. (PART - B)
3. WRITE SHORT NOTES ON BERKELEY SOCKET. (PART – B)
Services provided to the upper layer
 The ultimate goal of the transport layer is to provide efficient, reliable, and cost-effective data transmission
service to its users.
 The software and/or hardware within the transport layer that does the work is called the transport entity.
 The transport entity can be located in the operating system kernel, in a library package bound into network
applications, in a separate user process, or even on the network interface card.
 The first two options are most common on the Internet.

 There are also two types of transport service. The connection-oriented transport service is similar to the
connection-oriented network service in many ways.
Transport Service Primitives
 Each transport service has its own interface.
 The transport service is similar to the network service, but there are also some important differences.
 The main difference is that the network service is intended to model the service offered by real networks.
Real networks can lose packets, so the network service is generally unreliable.
 A second difference between the network services and transport service is that the services are planned for.
Berkley sockets
 These primitives are widely used for internet programming.
1
 They are listed in the following fig.

An Example of Socket Programming: An Internet File Server

ELEMENTS OF TRANSPORT PROTOCOLS


4. EXPLAIN THE ELEMENTS OF TRANSPORT LAYER. (PART - C)
5. DIFFERENTIATE BETWEEN DATA LINK LAYER AND TRANSPORT LAYER. (PART – B)
 In some ways, transport protocols resemble the data link protocols.
 At the data link layer, two routers communicate directly via a physical channel, whether wired or wireless,
whereas at the transport layer, this physical channel is replaced by the entire network.

CONNECTION MANAGEMENT

2
ADDRESSING, ESTABLISHING AND RELEASING A CONNECTION
6. WRITE ABOUT CONNECTION ESTATBLISHMENT PROCEDURE IN TRANSPORT LAYER.
(PART – B)
Addressing:
 When an application process wishes to set up a connection to a remote application process, it must specify
which one to connect. In the Internet, these end points are called ports.
 The generic term TSAP, (Transport Service Access Point) is used to specify the endpoint in the transport
layer.

 Application processes, both clients and servers, can attach themselves to a TSAP to establish a connection
to a remote TSAP. These connections run through NSAPs on each host, as shown.
 A possible scenario for a transport connection is as follows
1. TSAP 1522 to wait for an incoming call.
2. An application process on host 1 wants to find out the time-of-day.
3. The application process then sends over a request for the time.
4. The time server process responds with the current time.
5. The transport connection is then released

Connection Establishment:
 Transport service for connection establishment are:
 Listen: Block until some process tries to connect
 Connect: Actively attempt to establish a connection
 Send: Send information
 Receive: Block until a data packet arrives
 Disconnect: This release the connection

Two-way Handshaking:
3
 Connection establishment is asymmetric
 one side puts itself in a LISTEN state (server)
 one side issues a request for connection (client)

Two Way CR (SeqNo


Handshake
Host A
Host A
Host B
Host B
= x)
Connection
Request, A
Problems with Two-Way Handshake:
wants to
start with
Host A

B
Host B

SeqNo = x
Host A Host B

respond
sACK
to (SeqNo
= y)
CR(SeqN
Result: A starts to
Three-Way Handshake:
oAcknowledg
= z),
send data with
 Three Way Handshake is a process used for establishing a connection.
e request,
an old
Step-01: SYN-
Sequence x. B will
 For establishing a connection, B will wants
duplicat
throw the data
1. Client sends a request segment
2. Request segment consistsaway
to the server.
only of TCPsince ane
Header withit
to start with
empty payload.
SeqNo = y
expects SeqNo
3. Then, it waits for a reply segment from the server.
=z
connecti
DATA
on
(SeqNo = x)
requests
Data A
from
transmissio
In the
 Request segment contains the following information in TCP header-
1. Initial sequence number
n with
shown
2. SYN bit set to 1 SeqNo x
sce-
3. Maximum segment size
4. Receiving window size nario, A
Step-02: SYN + ACK-
believes
 After receiving the request segment, that the
4 ACK is
1. Server responds to the client by sending the reply segment.
2. It informs the client of the parameters at the server side.

 Reply segment contains the following information in TCP header-


1. Initial sequence number
2. SYN bit set to 1
3. Maximum segment size
4. Receiving window size
5. Acknowledgment number
6. ACK bit set to 1
Step-03: ACK-
 After receiving the reply segment,
1. Client acknowledges the response of server.
2. It acknowledges the server by sending a pure acknowledgement.

Retransmission:
 When sender discovers that the segment sent by it is lost, it retransmits the same segment to the receiver.
 After establishing the connection,
1. Sender starts transmitting TCP segments to the receiver.
2. A TCP segment sent by the sender may get lost on the way before reaching the receiver.
3. This causes the receiver to send the acknowledgement with same ACK number to the sender.
4. As a result, sender retransmits the same segment to the receiver.
5. This is called as retransmission.
 Sender discovers that the segment is lost when-
1. Either Time Out Timer expires
2. Or it receives three duplicate acknowledgements
5
Retransmission After Time Out Timer Expiry-
 Each time sender transmits a TCP segment to the receiver, it starts a Time Out Timer.
 Now, following two cases are possible-

Case-01:
1. Sender receives an acknowledgement for the sent segment before the timer goes off.
2. In this case, sender stops the timer.
Case-02:
1. Sender does not receives any acknowledgement for the sent segment and the timer goes off.
2. In this case, sender assumes that the sent segment is lost.
3. Sender retransmits the same segment to the receiver and resets the timer.

Retransmission After Receiving 3 Duplicate Acknowledgements-


 Consider sender receives three duplicate acknowledgements for a TCP segment sent by it.
 Then, sender assumes that the corresponding segment is lost.
 So, sender retransmits the same segment without waiting for its time out timer to expire.
 This is known as Early retransmission or Fast retransmission.
 Consider-
1. Sender sends 5 TCP segments to the receiver.
2. The second TCP segment gets lost before reaching the receiver.
 Now,
1. Sender receives 3 duplicate acknowledgements for segment-2 in total.
2. So, sender assumes that the segment-2 is lost.
3. So, it retransmits segment-2 without waiting for its timer to go off.

Connection Release:
6
 Consider-
1. There is a well established TCP connection between the client and server.
2. Client wants to terminate the connection.
Step-01:
 For terminating the connection,
1. Client sends a FIN segment to the server with FIN bit set to 1.
2. Client enters the FIN_WAIT_1 state.
3. Client waits for an acknowledgement from the server.

Step-02:
 After receiving the FIN segment,
1. Server frees up its buffers.
2. Server sends an acknowledgement to the client.
3. Server enters the CLOSE_WAIT state.

Step-03:
 After receiving the acknowledgement, client enters the FIN_WAIT_2 state.

Step-04:
 For terminating the connection,
1. Server sends a FIN segment to the client with FIN bit set to 1.
2. Server waits for an acknowledgement from the client.

Step-05:
 After receiving the FIN segment,
1. Client frees up its buffers.
2. Client sends an acknowledgement to the server (not mandatory).
3. Client enters the TIME_WAIT state.

7
A SIMPLE TRANSPORT PROTOCOL
The Example Service Primitives
The Example Transport Entity
The Example as a Finite State Machine

THE INTERNET TRANSPORT PROTOCOL


9. WRITE ABOUT UDP PACKET FORMAT. (PART - B)
10. EXPLAIN ABOUT RTP. (PART – B)
11. EXPLAIN ABOUT UPD. (PART – C)
12. DESCRIBE THE WORKING OF RPC. (PART – B)
13. WRITE ABOUT STREAM DELIVERY SERVICES IN TCP. (PART – B)
14. EXPLAIN THE TCP HEADER FORMAT WITH AN DIAGRAM. (PART – B)
15. WHAT IS ADDITIVE INCREASE AND MULITPLICATIVE DECREASE? EXPLAIN WITH AN
EXAMPLE. (PART – B)
16. DESCRIBE ABOUT TCP. (PART – C)
 The Internet has two main protocols in the transport layer, a connectionless protocol and a connection-
oriented one.
Introduction to UDP
 The User Datagram Protocol (UDP) is called a connectionless, unreliable transport protocol.
 It provide process-to-process communication instead of host-to-host communication.
 Also, it performs very limited error checking.
UDP Datagram:
 UDP packets, called user datagram have a fixed-size header of 8 bytes.

Source Port Number:


8
 It is 16 bits long, which means that the port number can range from 0 to 65,535.
 If the source host is the client, the port number will be UDP software running on the source host.
 If the source host is the server, the port number is a well-known port number.
Destination Port Number:
 If the destination host is the server, the port number is a well-known port number.
 If the destination host is the client, the port number is a port number.
Length:
 This is a 16-bit field that defines the total length of the user datagram header plus data.
Checksum:
 This field is used to detect errors over the entire user datagram.
UDP operation:
Connectionless Service:
 The user datagram are not numbered, there is no connection establishment and no connection release.
 Each user datagram can travel on a different path
Flow and Error Control:
 There is no flow control and hence no window mechanism. The receiver may overflow with incoming
messages.
 There is no error control mechanism in UDP except for the checksum. This means that the sender does
not know if a message has been lost or duplicated.
Encapsulation and Decapsulation:
 To send a message from one process to another, the UDP protocol encapsulates and decapsulates
messages in an IP datagram.
Remote Procedure Call
 A remote procedure call is an inter-process communication technique that is used for client-server based
applications. It is also known as a subroutine call or a function call.
 A client has a request message that the RPC translates and sends to the server.
 When the server receives the request, it sends the required response back to the client.

 The sequence of events in a RPC are given as:


 The client calls the client stub. The call is a local procedure call with parameters pushed onto the stack.

9
 The client stub packs the procedure parameters into a message. The packing of the procedure parameters
is called marshalling.
 The client's local OS sends the message from the client machine to the remote server machine.
 The server OS passes the incoming packets to the server stub.
 The server stub unpacks the parameters -- called unmarshalling.
 When the server procedure is finished, it returns to the server stub, which marshals the return values
into a message.
 The server stub then hands the message to the transport layer.
 The transport layer sends the resulting message back to the client transport layer, which hands the
message back to the client stub.
 The client stub unmarshalls the return parameters, and execution returns to the caller.

Real Time Transport Protocol (RTP)


 Real-time Transport Protocol (RTP) is the protocol designed to handle real-time traffic on the Internet.
 RTP does not have a delivery mechanism (multicasting, port numbers, and so on); it must be used with
UDP.
 RTP stands between UDP and the application program.

RTP Packet Format


 Version: This 2-bit field defines the version number. The current version is 2.
 P: This 1-bit field, if set to 1, indicates the presence of padding at the end of the packet.

10
 X: This 1-bit field, if set to 1, indicates an extra extension header between the basic header and the data.

 Contributor count: This 4-bit field indicates the number of contributors.


 M: This 1-bit field is a marker used by the application to indicate.
 Payload Type: This 7-bit field indicates the type of the payload.
 Sequence Number: It is used to number of RTP packets. The sequence number of the first packet is chosen
randomly and incremented by 1 for each subsequent packet.
 Timestamp: This is a 32-bit field that indicates the time relationship between packets. The timestamp for
the first packet is a random number.
 Synchronization Source Identifier: If there is only one source, this 32-bit field defines the source.
However, if there are several sources, the mixer is the synchronization source and the other sources are
contributors.
 Contributor Identifier: Each of these 32-bit identifiers (a maximum of 15) defines a source.

Introduction to TCP
 It provides a reliable transport service between pairs of processes executing end system using the network
layer service provided by the IP protocol.
TCP Service Model
Process-to-Process Communication:
 TCP provides process-to-process communication using port numbers. Table lists some well-known port
numbers used by TCP.
Port Protocol Description
7 Echo Echoes a received datagram back to the sender
9 Discard Discards any datagram that is received
11 Users Active users
13 Daytime Returns the date and the time
53 DNS Domain Name Server
80 HTTP Hypertext Transfer Protocol

11
111 RPC Remote Procedure Call
Stream Delivery Service:
 TCP allows the sending process to deliver data as a stream of bytes and allows the receiving process to
obtain data as a stream of bytes.
 The sending process produces (writes to) the stream of bytes, and the receiving process consumes (reads
from) them.

Full-Duplex Communication:
 TCP offers full-duplex service, in which data can flow in both directions at the same time.
 Each TCP then has a sending and receiving buffer, and segments move in both directions.

Connection-Oriented Service:
 TCP is a connection-oriented protocol.
 When a process at site A wants to send and receive data from another process at site B, the following
occurs:
1. The two TCPs establish a connection between them.
2. Data are exchanged in both directions.
3. The connection is terminated.

Reliable Service:
 TCP is a reliable transport protocol.
 It uses an acknowledgment mechanism to check the safe and sound arrival of data.
TCP Protocol
TCP Segment Header

12
 Source port: Defines the port number of the application program in the host that is sending the segment.
 Destination port: Defines the port number of the application program in the host that is receiving the
segment.
 Sequence number: It tells the destination which byte to be transmitted is numbered.
 Acknowledgment number: Defines the byte number
 Header Length: The length of the header can be between 20 and 60 bytes.
 Reserved: Remains reserved for future use.
 Control: This field defines 6 different control bits or flags. One or more of these bits can be set at a time.
 Window: Specifies the size of the sender receiver widows. The maximum size of the window is 65,535
bytes.
 Checksum: Indicates whether the header was damaged in transmit.
 Urgent pointer: Which is valid only if the urgent flag is set and it is used when the segment contains urgent
data.
 Options: Specifies various TCP options

TCP Connection Establishment


 TCP transmits data in full-duplex mode.
 The connection establishment in TCP is called
threeway handshaking.
 The process starts with the server.
 The server program tells its TCP that it is ready to
accept a connection. This is called a request for a
passive open.
 Although the server TCP is ready to accept any
connection from any machine in the world, it cannot
make the connection itself.
 The client program issues a request for an active open. A client that wishes to connect to an open server
tells its TCP that it needs to be connected to that particular server.

Data Transfer
 After connection is established, bidirectional data
transfer can take place. The client and server can both
send data and acknowledgments.

13
Connection Release
 Any of the two parties involved in exchanging data (client or
server) can close the connection, although it is usually initiated
by the client.

TCP Connection Management Modeling


TCP Transmission Policy
 Window management in TCP is not directly tied to acknowledgment as it is in most data link protocols

TCP Congestion Control


 TCP’s general policy for handling congestion is based on three phases: slow start, congestion avoidance,
and congestion detection.
Slow Start: Exponential Increase :
 This algorithm is based on the idea that
the size of the congestion window
(cwnd) starts with one maximum
segment size (MSS).
 The MSS is determined during
connection establishment.
 The size of the window increases one
MSS each time an acknowledgment is received.

Congestion Avoidance: Additive Increase:


 TCP defines another algorithm called congestion avoidance, which undergoes an additive increase instead
of an exponential one.
 When the size of the congestion window reaches the slow-start threshold, the slow-start phase stops and the
additive phase begins.
 In this algorithm, each time the whole window of segments is acknowledged (one round), the size of the
congestion window is increased by 1.

Multiplicative Decrease Congestion Detection:


 If congestion occurs, the congestion window size must be decreased.
 The size of the threshold is dropped to one-half, a multiplicative decrease.

14
TCP Timer Management
Wireless TCP and UDP
Transactional TCP

NETWORK SECURITY
 It is a set of rules and configurations designed to protect the integrity, confidentiality and
accessibility of computer networks and data using both software and hardware
technologies.

CRYPTOGRAPHY
10. WRITE SHORT NOTES ON CRYPTOGRAPHY. (PART - B)
11. EXPLAIN THE ALGORITHMS USED IN CRYPTOGRAPHY. (PART - C)
12. DESCRIBE ABOUT SUBSTITUTION CIPHERS. (PART – B)
13. WRITE ABOUT TRANSPOSITION. (PART – B)
Introduction to Crytography
 Cryptography is a method of storing and transmitting data in a particular form.
 Plain text is converted into a numerical value then it is encrypted with an encryption key,
and then we get the ciphered text.

Substitution Ciphers

15
 Substitution technique is a classical encryption technique where the characters present in
the original message are replaced by the other characters or numbers or by symbols
Caesar Cipher:
 This the simplest substitution cipher by Julius Caesar.
 In this substitution technique, to encrypt the plain text, each alphabet of the plain text is
replaced by the alphabet three places further it.
 And to decrypt the cipher text each alphabet of cipher text is replaced by the alphabet three
places before it.
 A full translation chart of Caesar cipher are:

Example: Security would be encoded as vhfxulwb


Simple Substitution Cipher:
 It is an improvement to the Caesar cipher.
 Instead of shifting the alphabet by some number, this scheme uses some permutation of
letters in alphabet.
 This permutation is a secret key.

Transpositions Ciphers
 A transposition is an encryption in which the letters of the message are rearranged.
 The columnar transposition is a rearrangement of the characters of the plaintext into
columns.
 The plaintext characters are written in rows of five and arranged one row after another,
as shown here:
C1 C2 C3 C4 C5
16
C6 C7 C8 C9 C10
C11 C12 Etc.,

 The transposition can be formed as:

 Suppose if the plain text message is, security then it can be arranged in five columns as:

S E C U R
I T Y

 The resulting ciphertext will be:


SIETCYUR

One-time Pads
 In this technique, a plaintext is paired with a random secret key
 Then, each bit or character of the plaintext is encrypted by combining it with the
corresponding bit or character from the pad using modular addition.

17
Calculation:

Encoding:

Decoding:

Two Fundamental Cryptographic Principles


Redundancy:
 Some redundancy must be there in all the encrypted messages.
 The information that is not required for understanding the message reducing the chances for
a passive intruder to make attacks.
 Adding a good amount of redundancy prevents the active intruders from sending garbage
values and then getting it verified as some valid message.
Freshness:
 The second cryptographic principle is that some measures must be taken to ensure that each
message received can be verified as being fresh, that is, sent very recently.
 Cryptographic principle 2: “Some method is needed to foil replay attacks.”
 Include timestamp in every message.

18
 Suppose after 10 sec, message must be thrown out of the network

-------------------UNIT-V COMPLETED-------------------

REFERENCE:
1. Computer Networks‖ Andrew S. Tanenbaum , Fourth edition,PHI private Ltd, NewDelhi , 2008
2. www.slideshare.com
3. www.tutorialspoint.com

POSSIBLE QUESTIONS
PART - A (1 MARK)
1. Transport layer aggregates data from different applications into a single stream before passing it to
____________
a) network layer b) data link layer c) application layer d) physical layer
2. Which of the following are transport layer protocols used in networking?
a) TCP and FTP b) UDP and HTTP c) TCP and UDP d) HTTP and FTP
3. User datagram protocol is called connectionless because _____________
a) all UDP packets are treated independently by transport layer
b) it sends data as a stream of related packets
c) it is received in the same order as sent order
d) it sends data very quickly
4. Transmission control protocol ___________
a) is a connection-oriented protocol b) uses a three way handshake to establish a connection
c) receives data from application as a single stream d) all of the mentioned
5. An endpoint of an inter-process communication flow across a computer network is called __________
a) socket b) pipe c) port d) machine
6. Which one of the following is a version of UDP with congestion control?
a) datagram congestion control protocol b) stream control transmission protocol
c) structured stream transport d) user congestion control protocol
7. A _____ is a TCP name for a transport service access point.
a) port b) pipe c) node d) protocol
8. Transport layer protocols deals with ____________
a) application to application communication b) process to process communication
c) node to node communication d) man to man communication
9. Which of the following is a transport layer protocol?
a) stream control transmission protocol b) internet control message protocol
19
c) neighbor discovery protocol d) dynamic host configuration protocol
10. Which of the following is a transport layer protocol?
a) DNS b) HTTP c)TCP d)ARP

PART – B (5 MARKS)
1. Write short notes on services provided to the upper layer by transport layer. (Refer Page

No.1 ,Q. No.2)


2. Write short notes on Berkeley socket. (Refer Page No.1 ,Q. No.3)

3. Differentiate between data link layer and transport layer. (Refer Page No.2,Q. No.5)

4. Write about connection establishment procedure in transport layer. (Refer Page No.3,Q.

No.6)
5. Write about flow control and error control. (Refer Page No.8 ,Q. No.7)

6. Write about UDP packet format. (Refer Page No.15 ,Q. No.9)

7. Explain about RTP. (Refer Page No.15 ,Q. No.10)

8. Describe the working of RPC. (Refer Page No.15,Q. No.12)

9. Write about stream delivery service in TCP. (Refer Page No.18 ,Q. No.13)

10. Explain the TCP header format with an diagram. (Refer Page No.18 ,Q. No.14)

11. What is additive increase and multiplicative decrease? Explain with an example. (Refer

Page No.18 ,Q. No.15)

PART – C (10 MARKS)


1. Write about transport layer services. (Refer Page No.1 ,Q. No.1)

2. Explain the elements of transport layer. (Refer Page No.2,Q. No.4)

3. Explain about congestion control with an neat diagram. (Refer Page No.12,Q. No.8)

4. Explain about UPD. (Refer Page No.15,Q. No.11)

5. Describe about TCP. (Refer Page No.18 ,Q. No.16)

20

You might also like