310 likes | 415 Views
ICE 302 Transport layer. Md. Asif Hossain Term # 2 Lecture # 2. Thanks to A. B. Forouzan. This is the presentation slides of the Book You MUST go through this TEXT BOOK for your further learning and for the EXAMS. So, without reading the Book, you can not pass the exams.
E N D
ICE 302Transport layer Md. AsifHossain Term # 2 Lecture # 2 Thanks to A. B. Forouzan
This is the presentation slides of the Book • You MUST go through this TEXT BOOK for your further learning and for the EXAMS. • So, without reading the Book, you can not pass the exams. • Read the topics that will be covered in the classes. • You can take the helps from the other related Books. 3rd Edition
Transmission Control Protocol • Port numbers
Transmission Control Protocol • Byte-stream connection-oriented & reliable transport protocol
TCP - buffers • Sending & receiving buffers • Processes do not consume data at the same speed • Sending site: • White section: empty locations to be filled by sending process • Blue section: bytes sent but not yet acknowledged • Red section: bytes to be sent by sending TCP • Receiving site: • White section: empty locations to be filled by bytes from the networks • Red section: received bytes to be consumed by the receiving process
TCP – bytes & segments • TCP at the sending site gathers bytes into a packet called a segment • TCP adds a header to each segment and delivers it to IP for transmission • Segments can arrive out of order • Size of the segment varies
TCP – numbering bytes Numbering is used for flow & error control Segments are not numbered, only bytes Full-duplex connection – numbering is independent in each direction Numbers generated randomly from 0 to 232-1 • Sequence number • The number of the first byte carried in the segment • Acknowledgement number • To confirm received bytes • Defines the number of the next byte the party expects to receive • Cumulative
TCP numbering – an example 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)
Connection termination • Four steps TCP - connections • Connection establishment • Three-way handshake Why is two-way handshake not enough?
TCP – a state transition diagram TCP server lifecycle Transport Layer TCP client lifecycle
Flow control • Remember? • The amount of data a source can send before receiving an ACK from the destination • Whether to send 1 byte of data and wait for ACK or send all bytes and wait for the ACK for the complete message? • TCP gives a solution in between • Sliding window protocol • byte oriented
Flow Control • Avoids the problem of a host at one side of the connection overflowing the buffers in the host at the other side • Ensures the integrity of the data
Session Maintenance and Termination • Congestion can occur during data transfer • To terminate, the sending host sends a signal that indicates the end of the transmission, which is acknowledged by the receiver.
Flow control (cnt’d) sender buffer Direction of transmission • If no window, a sender can send all bytes without regarding the condition of the receiver • if data are consumed too slowly then receiver buffer becomes full -> drop the packet (retransmit) • the sender must adjust itself to the number of the free locations in the receiver buffer
Sender window Flow control (cnt’d) • Receiver window M N N-M = receiver window
Flow control (cnt’d) Direction of window shift • sliding widow • ACK is received for bytes 200-202 • the sender can send bytes 205-209 Direction of transmission • expanding the sender widow • shrinking the sender widow
rdt3.0 works, but performance stinks example: 1 Gbps link, 15 ms e-e prop. delay, 1KB packet: Performance of rdt 3.0 (Reliable data transfer over a lossy channel with bit errors) L (packet length in bits) 8kb/pkt T = = = 8 microsec transmit R (transmission rate, bps) 10^9 b/sec • U sender: utilization – fraction of time sender busy sending • 1KB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link • network protocol limits use of physical resources!
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 Pipelined protocols Transport Layer
The “a” Factor • a = (Round Trip Time)/(Transmission time) • Transmission time (L) is usually represented in bits and Round Trip Time (RTT) is usually given in time units (say 50 ms). • small a – implies low RTT or Large L; usually LANs with large packets. • large a – implies high RTT or small L; usually WANs or LANS with small packets; or highly congested network. Transport Layer
Stop and Wait Link Utilization (cont.) • Tx time = RTT + L +TA TA – time to tx ack frame (small and ignored) Therefore, Tx time = RTT + L • U = L/(Tx time)= L/(L+RTT)= 1/(1+a) • For large a, U is small • For small a, U is high Transport Layer
In a GBN protocol, the sender is allowed to transmit multiple packets without waiting for an acknowledgment, but is constrained to have no more than some maximum allowable number, N, of unacknowledged packets in the pipeline. Go-Back-N
GBN inaction Transport Layer
receiver individually acknowledges all correctly received pkts buffers pkts, as needed, for eventual in-order delivery to upper layer sender only resends pkts for which ACK not received sender timer for each unACKed pkt sender window N consecutive seq #’s again limits seq #s of sent, unACKed pkts Selective Repeat Transport Layer
Selective repeat in action Transport Layer
Error control in TCP • Detect corrupted segments; lost segments; out-of-order segments & duplicated segments • Three tools: • checksum • acknowledgment • no NACKs • time-out • one time-out counter for each segment sent
Error control in TCP-duplicate & out-of-order segment- • Duplicate segment • the destination TCP simply discards the segment • Out-of-order segment • not acknowledged until it receives all the segments that precede it
TCP TIMERS • RetransmissionPersistenceKeep-aliveTime-waited