Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof....

21
1 Prof. Younghee Lee 1 Computer Networks Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared referencing the lecture note made by F. Kurose, Keith W. Ross(U. of Massachusetts)

description

Prof. Younghee Lee 3 3 Transport vs. network layer u network layer: logical communication between hosts u transport layer: logical communication between processes –relies on, enhances, network layer services Household analogy: 12 kids sending letters to 12 kids u processes = kids u app messages = letters in envelopes u hosts = houses u transport protocol = Ann and Bill u network-layer protocol = postal service

Transcript of Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof....

Page 1: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

1Prof. Younghee Lee1

Computer Networks Lecture 5: Transport services and protocols

Prof. Younghee Lee

* Some part of this teaching materials are prepared referencing the lecture note made by F. Kurose, Keith W. Ross(U. of Massachusetts)

Page 2: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

2Prof. Younghee Lee2

Transport services and protocols provide logical communication

between app processes running on different hosts

transport protocols run in end systems – send side: breaks app mes

sages 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

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysicalnetwork

data linkphysical

logical end-end transport

Page 3: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

3Prof. Younghee Lee3

Transport vs. network layer network layer: logical

communication between hosts

transport layer: logical communication between processes – relies on, enhances,

network layer services

Household analogy:12 kids sending letters to

12 kids processes = kids app messages = letters

in envelopes hosts = houses transport protocol = Ann

and Bill network-layer protocol =

postal service

Page 4: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

4Prof. Younghee Lee4

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

transportnetworkdata linkphysical

application

transportnetworkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysical

networkdata linkphysicalnetwork

data linkphysical

logical end-end transport

Page 5: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

5Prof. Younghee Lee5

Connectionless demux (cont)

DatagramSocket serverSocket = new DatagramSocket(6428);

ClientIP:B

P2

client IP: A

P1P1P3

serverIP: C

SP: 6428DP: 9157

SP: 9157DP: 6428

SP: 6428DP: 5775

SP: 5775DP: 6428

SP provides “return address”

Page 6: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

6Prof. Younghee Lee6

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

Page 7: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

7Prof. Younghee Lee7

Connection-oriented demux (cont)

ClientIP:B

P1

client IP: A

P1P2P4

serverIP: C

SP: 9157DP: 80

SP: 9157DP: 80

P5 P6 P3

D-IP:CS-IP: AD-IP:C

S-IP: B

SP: 5775DP: 80

D-IP:CS-IP: B

Page 8: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

8Prof. Younghee Lee8

Connection-oriented demux: Threaded Web Server

ClientIP:B

P1

client IP: A

P1P2

serverIP: C

SP: 9157DP: 80

SP: 9157DP: 80

P4 P3

D-IP:CS-IP: AD-IP:C

S-IP: B

SP: 5775DP: 80

D-IP:CS-IP: B

Page 9: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

9Prof. Younghee Lee9

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

Page 10: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

10Prof. Younghee Lee10

UDP: more

often used for streaming multimedia apps– loss tolerant– rate sensitive

other UDP uses– DNS– SNMP

reliable transfer over UDP: add reliability at application layer– application-specific error

recovery!

source port # dest port #32 bits

Applicationdata

(message)

UDP segment format

length checksumLength, in

bytes of UDPsegment,including

header

Page 11: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

11Prof. Younghee Lee11

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

Page 12: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

12Prof. Younghee Lee12

rdt3.0: stop-and-wait operation

first packet bit transmitted, t = 0

sender receiver

RTT

last packet bit transmitted, t = L / R

first packet bit arriveslast packet bit arrives, send ACK

ACK arrives, send next packet, t = RTT + L / R

U sender = .008

30.008 = 0.00027

microseconds

L / R RTT + L / R

=

Page 13: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

13Prof. Younghee Lee13

Pipelined protocols

Pipelining: sender allows multiple, “in-flight”, yet-to-be-acknowledged pkts– range of sequence numbers must be increased– buffering at sender and/or receiver

Two generic forms of pipelined protocols: go-Back-N, selective repeat

Page 14: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

14Prof. Younghee Lee14

Pipelining: increased utilization

first packet bit transmitted, t = 0

sender receiver

RTT

last bit transmitted, t = L / R

first packet bit arriveslast packet bit arrives, send ACK

ACK arrives, send next packet, t = RTT + L / R

last bit of 2nd packet arrives, send ACKlast bit of 3rd packet arrives, send ACK

U sender = .024

30.008 = 0.0008

microseconds

3 * L / R RTT + L / R

=

Increase utilizationby a factor of 3!

Page 15: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

15Prof. Younghee Lee15

Go-Back-NSender: k-bit seq # in pkt header “window” of up to N, consecutive unack’ed pkts allowed

ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK”– may deceive duplicate ACKs (see receiver)

timer for each in-flight pkt timeout(n): retransmit pkt n and all higher seq # pkts in window

Page 16: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

16Prof. Younghee Lee16

GBN inaction

Page 17: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

17Prof. Younghee Lee17

Selective Repeat

receiver individually acknowledges all correctly received pkts– buffers pkts, as needed, for eventual in-order delivery to u

pper layer sender only resends pkts for which ACK not receive

d– sender timer for each unACKed pkt

sender window– N consecutive seq #’s– again limits seq #s of sent, unACKed pkts

Page 18: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

18Prof. Younghee Lee18

Selective repeat: sender, receiver windows

Page 19: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

19Prof. Younghee Lee19

Selective repeatdata from above : if next available seq # in windo

w, send pkt

timeout(n): resend pkt n, restart timerACK(n) in [sendbase,sendbase+N]: mark pkt n as received if n smallest unACKed pkt, adv

ance window base to next unACKed seq #

senderpkt n in [rcvbase, rcvbase+N-1] send ACK(n) out-of-order: buffer in-order: deliver (also deliver

buffered, in-order pkts), advance window to next not-yet-received pkt

pkt n in [rcvbase-N,rcvbase-1] ACK(n)

otherwise: ignore

receiver

Page 20: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

20Prof. Younghee Lee20

Selective repeat in action

Page 21: Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.

21Prof. Younghee Lee21

Selective repeat: dilemma

Example: seq #’s: 0, 1, 2, 3 window size=3

receiver sees no difference in two scenarios!

incorrectly passes duplicate data as new in (a)

Q: what relationship between seq # size and window size?