Docsity

Transport Layer: Understanding UDP and TCP Protocols, Slides of Computer Networks

Partial preview of the text

Download Transport Layer: Understanding UDP and TCP Protocols and more Slides Computer Networks in PDF only on Docsity!

Transport Services

Computer Networks

Lect-

TRANSPORT LAYER

Transport Layer 3-

CHAPTER 3 OUTLINE

»3.1 Transport-layer services

»3.2 Multiplexing and

demultiplexing

»3.3 Connectionless

transport: UDP

»3.4 Principles of reliable

data transfer

»3.5 Connection-oriented

transport: TCP

Ā» segment structure

Ā» reliable data transfer

Ā» flow control

Ā» connection management

»3.6 Principles of congestion

control

»3.7 TCP congestion control

Transport Layer 3-

TRANSPORT SERVICES AND PROTOCOLS

»provide logical communication

between app processes running on

different hosts

»transport protocols run in end

systems

Ā» send side: breaks app

messages into segments,

passes to network layer

Ā» rcv side: reassembles

segments into messages,

passes to app layer

»more than one transport protocol

available to apps

Ā» Internet: TCP and UDP

application

transport

network

data link

physical

application

transport

network

data link

physical

network

data link

physical

network

data link

physical

network

data link

physical

network

data link

physical network

data link

physical

Transport Layer 3-

INTERNET TRANSPORT-LAYER PROTOCOLS

»reliable, in-order delivery

(TCP)

Ā» congestion control

Ā» flow control

Ā» connection setup

»unreliable, unordered

delivery: UDP

Ā» no-frills extension of ā€œbest-

effortā€ IP

»services not available:

Ā» delay guarantees

Ā» bandwidth guarantees

application

transport

network

data link

physical

application

transport

network

data link

physical

network

data link

physical

network

data link

physical

network

data link

physical

network

data link

physical network

data link

physical

Transport Layer 3-

CHAPTER 3 OUTLINE

»3.1 Transport-layer services

»3.2 Multiplexing and

demultiplexing

»3.3 Connectionless

transport: UDP

»3.4 Principles of reliable

data transfer

»3.5 Connection-oriented

transport: TCP

Ā» segment structure

Ā» reliable data transfer

Ā» flow control

Ā» connection management

»3.6 Principles of congestion

control

»3.7 TCP congestion control

Transport Layer 3-

HOW DEMULTIPLEXING WORKS

»host receives IP datagrams

Ā» each datagram has source IP

address, destination IP address

Ā» each datagram carries 1 transport-

layer segment

Ā» each segment has source,

destination port number

(recall: well-known port numbers

for specific applications)

»host uses IP addresses & port numbers to

direct segment to appropriate socket

source port # dest port #

32 bits

application

data

(message)

other header fields

TCP/UDP segment format

Transport Layer 3-

CONNECTIONLESS DEMULTIPLEXING

»Create sockets with port

numbers:

DatagramSocket mySocket1 = new

DatagramSocket(99111);

DatagramSocket mySocket2 = new

DatagramSocket(99222);

»UDP socket identified by two-

tuple:

(dest IP address, dest port number)

»When host receives UDP

segment:

Ā» checks destination port

number in segment

Ā» directs UDP segment to socket

with that port number

»IP datagrams with different

source IP addresses and/or

source port numbers directed

to same socket

Transport Layer 3-

CONNECTION-ORIENTED DEMUX

»TCP socket identified by 4-

tuple:

Ā» source IP address

Ā» source port number

Ā» dest IP address

Ā» dest port number

»recv host uses all four values

to direct segment to

appropriate socket

»Server host may support

many simultaneous TCP

sockets:

Ā» each socket identified by its

own 4-tuple

»Web servers have different

sockets for each connecting

client

Ā» non-persistent HTTP will have

different socket for each

request

Transport Layer 3-

CONNECTION-ORIENTED DEMUX (CONT)

Client

IP:B

P

client

IP: A

P

P

P

server

IP: C

SP: 9157

DP: 80

SP: 9157

DP: 80

P

P

P

D-IP:C

S-IP: A

D-IP:C

S-IP: B

SP: 5775

DP: 80

D-IP:C

S-IP: B

Transport Layer 3-

CHAPTER 3 OUTLINE

»3.1 Transport-layer services

»3.2 Multiplexing and

demultiplexing

»3.3 Connectionless

transport: UDP

»3.4 Principles of reliable

data transfer

»3.5 Connection-oriented

transport: TCP

Ā» segment structure

Ā» reliable data transfer

Ā» flow control

Ā» connection management

»3.6 Principles of congestion

control

»3.7 TCP congestion control

Transport Layer 3-

UDP: USER DATAGRAM PROTOCOL [RFC 768]

Ā»ā€œno frills,ā€ ā€œbare bonesā€ Internet

transport protocol

Ā»ā€œbest effortā€ service, UDP

segments may be:

Ā» lost

Ā» delivered out of order to

app

Ā» connectionless:

Ā» no handshaking between

UDP sender, receiver

Ā» each UDP segment handled

independently of others

Why is there a UDP?

»no connection establishment

(which can add delay)

»simple: no connection state at

sender, receiver

»small segment header

»no congestion control: UDP can

blast away as fast as desired

Transport Layer 3-

UDP CHECKSUM

Sender:

»treat segment contents as

sequence of 16-bit integers

Ā»checksum: addition (1’s

complement sum) of segment

contents

»sender puts checksum value

into UDP checksum field

Receiver:

»compute checksum of received

segment

»check if computed checksum equals

checksum field value:

Ā» NO - error detected

Ā» YES - no error detected. But

maybe errors nonetheless?

More later ….

Goal: detect ā€œerrorsā€ (e.g., flipped bits) in transmitted

segment

INTERNET CHECKSUM EXAMPLE

»Note

Ā» When adding numbers, a carryout from the most significant bit

needs to be added to the result

»Example: add two 16-bit integers

wraparound

sum

checksum