Download presentation
Presentation is loading. Please wait.
1
Transport Layer Our goals:
understand principles behind transport layer services: multiplexing/demultiplexing reliable data transfer flow control congestion control Services of transport layer are constrained by N/W layer. learn about transport layer protocols in the Internet: UDP: connectionless transport TCP: connection-oriented transport TCP congestion control TCP : Segment UDP: Datagram
2
Transport services and protocols
provide logical communication between app processes running on different hosts transport protocols run in end systems sending side: breaks app messages into segments, passes to network layer receiving 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 network data link physical network data link physical network data link physical logical end-end transport network data link physical network data link physical application transport network data link physical
3
Transport vs. network layer
network layer: logical communication between hosts transport layer: logical communication between processes relies on, enhances, network layer services IP (Internet Protocol) is a Network Layer protocol Unreliable Best Effort Service No ordering of segments No guaranteed delivery
4
Internet transport-layer protocols
reliable, in-order delivery (TCP) congestion control flow control connection setup Integrity checking unreliable, unordered delivery: UDP no-frills extension of “best-effort” IP services not available: delay guarantees bandwidth guarantees application transport network data link physical network data link physical network data link physical network data link physical logical end-end transport network data link physical network data link physical application transport network data link physical
5
Multiplexing/demultiplexing
Multiplexing at send host: Demultiplexing at rcv host: delivering received segments to correct socket gathering data from multiple sockets, enveloping data with header (later used for demultiplexing) = socket = process application transport network link physical P1 P2 P3 P4 host 1 host 2 host 3
6
Connectionless demultiplexing
Create sockets with port numbers: DatagramSocket mySocket1 = new DatagramSocket(49911); DatagramSocket mySocket2 = new DatagramSocket(49922); 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
7
Connectionless demux (cont)
DatagramSocket serverSocket = new DatagramSocket(6428); P2 P1 P1 P3 SP: 6428 DP: 9157 SP: 6428 DP: 5775 SP: 9157 DP: 6428 SP: 5775 DP: 6428 client IP: A Client IP:B server IP: C SP provides “return address”
8
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
9
Connection-oriented demux (cont)
P1 P4 P5 P6 P2 P1 P3 SP: 9157 DP: 80 S-IP: A D-IP:C SP: 5775 DP: 80 D-IP:C S-IP: B SP: 9157 DP: 80 D-IP:C client IP: A Client IP:B server IP: C S-IP: B
10
Connection-oriented demux: Threaded Web Server
P1 P4 P5 P6 P2 P1 P3 SP: 5775 DP: 80 S-IP: B D-IP:C SP: 9157 SP: 9157 DP: 80 client IP: A DP: 80 Client IP:B server IP: C S-IP: A S-IP: B D-IP:C D-IP:C
11
UDP
12
Position of UDP in the TCP/IP protocol suite
13
UDP: User Datagram Protocol [RFC 768]
“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
14
User datagram format Application data (message) UDP segment format
source port # dest port # 32 bits Application data (message) UDP segment format length checksum Length, in bytes of UDP segment, including header
15
UDP Cont… often used for streaming multimedia apps loss tolerant
rate sensitive reliable transfer over UDP: add reliability at application layer application-specific error recovery!
16
UDP Advantages No extra processing of data.
No connection establishment (which can add delay) Simple: no connection state at sender, receiver Small packet header overhead No congestion control: UDP can blast away as fast as desired
17
The following is a dump of a UDP header in hexadecimal format.
a. What is the source port number? b. What is the destination port number? c. What is the total length of the user datagram? d. What is the length of the data? e. Is the packet directed from a client to a server or vice versa? f. What is the client process?
18
Solution a. The source port number is the first four hexadecimal digits (CB84)16 or b. The destination port number is the second four hexadecimal digits (000D)16 or 13. c. The third four hexadecimal digits (001C)16 define the length of the whole UDP packet as 28 bytes. d. The length of the data is the length of the whole packet minus the length of the header, or 28 – 8 = 20 bytes. e. Since the destination port number is 13 (well-known port), the packet is from the client to the server. f. The client process is the Daytime
19
Given UDP header in hexadecimal format: 0632 000D 001C E217
i) Source port number? ii) Destination port number? iii) Total length of user datagram? iv) Length of data? What is client process? v) Is the packet directed from a client to server or vice-versa? Given UDP header in hexadecimal format: D 00 1C E2 17 1. The source port number is that is 1586 in decimal 2. The destination port number is that is 13 3. The total length of the user datagram is that is 28bytes 4. The length of the data = 28-8 = 20 bytes. The client process is Daytime because destination port number(Destination port number represents Daytime process) 5. The packet is directed from a client to a server because destination port number is 13.
20
UDP checksum Goal: detect “errors” (e.g., flipped bits) in transmitted segment 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 ….
21
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 Kurose and Ross forgot to say anything about wrapping the carry and adding it to low order bit + 1 wraparound sum checksum
23
s
24
Sliding Window The seq number are modulo 2m, hence seq no= (0 to 2m -1). Say m=4 and size of window is 7.
25
Flow and Error Control Mechanisms
Stop-and-Wait Protocol Go-back-N Protocol Selective Repeat Protocol
26
Stop-and Wait Protocol
Sender and receiver use window size of 1 The sender sends one packet at a time and waits for an ack before sending the next one If pkt lost or corrupted receiver silently discards pkt. After time-out sender retransmits packet
28
Stop-and-Wait ARQ, damaged frame
When a receiver receives a damaged frame, it discards it and keeps its value of R. After the timer at the sender expires, another copy of frame 1 is sent.
29
Stop-and-Wait, lost ACK frame
If the sender doesn’t receives an ACK (or damaged ACK, it discards it) When the timer of the sender expires, the sender retransmits frame 1. Receiver has already received frame 1 and expecting to receive frame 0 (R=0). Therefore it discards the second copy of frame 1.
30
Stop-and-Wait, delayed ACK frame
The ACK can be delayed at the sender due to some problem It is received after the timer for frame 0 has expired. Sender retransmitted a copy of frame 0. However, R =1 means receiver expects to see frame 1. Receiver discards the duplicate frame 0. Sender receives 2 ACKs, it discards the second ACK.
32
Piggybacking A method to combine a data frame with ACK.
Station A and B both have data to send. Instead of sending separately, station A sends a data frame that includes an ACK. Station B does the same thing. Piggybacking saves bandwidth.
33
Stop-and-Wait implements:
Flow Control by forcing the sender to wait for an ack Error Control by discarding corrupted pkts and letting the sender resend unacked packets on timer expires. Inefficient Low channel utilization
34
Go-back-N Protocol Sequence number Ack number
0 to 2m-1, where m is bits for seq. number Ack number is cumulative and defines the sequence number of the next packet expected to arrive
35
Send Window The maximum size of the window is 2m − 1
Say, sliding window of size 7 (m = 3) for the Go-Back-N protocol.
37
Receive Window size of the receive window is always 1
When a correct packet is received, the window slides, Rn = (Rn + 1) modulo 2m Timer expires Ack received Data received from app and sent for 1st time
39
Timer not set for discarded Acks
41
Selective Repeat ARQ, sender and receiver windows
Go-Back-N ARQ simplifies the process at the receiver site. Receiver only keeps track of only one variable, and there is no need to buffer out-of-order frames, they are simply discarded. However, Go-Back-N ARQ protocol is inefficient for noisy link. It is bandwidth inefficient and slows down the transmission. In Selective Repeat ARQ, only the damaged frame is resent. More bandwidth efficient but more complex processing at receiver. It defines a negative ACK (NAK) to report the sequence number of a damaged frame before the timer expires. Maximum size of the send window is: 2m-1. For example, if m = 4, the sequence numbers go from 0 to 15, but the maximum size of the window is just 8 (it is 15 in the Go-Back-N Protocol).
42
Outstanding packet: waiting for ACK
Timer: separate timer for each outstanding pkt. Say m=2
44
Assume a sender sends 6 packets: packets 0, 1, 2, 3, 4, and 5
Assume a sender sends 6 packets: packets 0, 1, 2, 3, 4, and 5. The sender receives an ACK with ackNo = 3. What is the interpretation if the system is using GBN or SR?
45
If the system is using GBN, it means that packets 0, 1, and 2 have been received uncorrupted and the receiver is expecting packet 3. If the system is using SR, it means that packet 3 has been received uncorrupted; the ACK does not say anything about other packets.
47
If we receive a corrupted frame and a NAK has not yet been sent, we send a NAK to tell the other site that we have not received the frame we expected. The first NAK sent is remembered (using the nakSent variable) and is not sent again until the frame slides. A NAK is sent once for each window position and defines the first slot in the window.
48
The next point is about the ACKs.
In Selective Repeat, ACKs are sent when data are delivered to the upper layer. If the data belonging to n frames are delivered in one shot, only one ACK is sent for all of them. Individual timer is set for each segment.
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.