Docsity

Transport Layer - Computer Networks and Protocols - Lecture Notes, Study notes of Computer Networks

Toggle sidebar
bg1
From whence comes reliability?
Person: I want something that's
reliable and sequenced and runs
over UDP.
Me: If you want something reliable
and sequenced, you should use
TCP.
Person: But I want to do something
less complex than TCP.
An interesting conversation (that I
have over and over with my
students):
Use it.
a.
Implement it.
b.
Me: If you want what TCP gives, you
have two options:
From whence comes reliability?
Monday, February 06, 2012
9:53 AM
Transport_Layer Page 1
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20

Partial preview of the text

Download Transport Layer - Computer Networks and Protocols - Lecture Notes and more Study notes Computer Networks in PDF only on Docsity!

From whence comes reliability? Person: I want something that's reliable and sequenced and runs over UDP. Me: If you want something reliable and sequenced, you should use TCP. Person: But I want to do something less complex than TCP. An interesting conversation (that I have over and over with my students): a. Use it. b. Implement it. Me: If you want what TCP gives, you have two options: There is no "free lunch" that you get by trying to synthesize TCP-like behavior with UDP. But there is a free lunch if you don't need certain attributes of TCP. From whence comes reliability? Monday, February 06, 2012 9:53 AM Docsity.com

We study how TCP handles reliability. We develop a model of how TCP is implemented, that informs us of the proper assumptions in writing TCP applications. We scratch the surface of the true complexity of the TCP protocol. In today's installment: In today's installment: Monday, February 06, 2012 9:56 AM Docsity.com

define useful properties of connection-based and connectionless protocols.  implement reliable stream communication based on IP datagrams (not UDP, but a lower level).  Jobs of the transport layer  provide point-to-point unreliable communications.  detect (and simply drop) communications errors. Transport layer part 1: UDP  source port  destination port  length  checksum  data UDP header:  appropriate length for data.  checksum of data matches recorded checksum. otherwise packet is assumed to be corrupted and is simply dropped.  UDP validity checks: Jobs of the transport layer Thursday, September 22, 2005 7:49 AM Docsity.com

Think of the data as an array of bytes. Sum the bytes with underflow. If the computed checksum = recorded checksum, evidence that data is ok. If the computed checksum != recorded checksum, PROOF that data is bad. The result is a "checksum". Checksums Tuesday, February 07, 2012 6:11 PM Docsity.com

From simple to complex. Adding one complexity at a time. Game of this discussion: stepwise refinement Game of this discussion Tuesday, February 07, 2012 6:19 PM Docsity.com

FSM model #1: the simplest model Write and read interact with queues. Write queue : holds data before it is written to the network. Read queue : holds data before it is read by the application. Write function queues data; data sent later. Read function dequeues data that has been received before. Think of stream as a queue of data.  enqueue(data) : add some.  data=dequeue() : get some from queue.  empty(): TRUE if no more data  full(): TRUE if there is no more space. Primitive operations enqueue(data); /* get data ready to send */ In application write() call: packet = wrap_packet(dequeue()) send(packet); if (!empty()) { } In sending driver:  application is producer  driver is consumer Note: this is a producer-consumer relationship. while(packet=recv()) { In receiving driver: data = unwrap_packet(packet); enqueue(data); The simplest FSM model Thursday, September 22, 2005 7:56 AM Docsity.com

Picture of TCP queueing Monday, February 06, 2012 1:10 PM Docsity.com

at any time, there is a state to each side of the connection.   packets pending for send (on sending side)  packets pending for read (on receiving side)  state includes: state is asynchronous from application! I.e., the concepts of "application state" and "TCP state" are distinct and unrelated.  TCP is "stateful" TCP is "stateful" Thursday, September 22, 2005 7:56 AM Docsity.com

Write blocks (and waits) if the send queue is full (if, e.g., writes are occurring faster than the network can handle them). Read blocks (and waits) if the receive queue is empty (if input is not ready yet). But a third thing can happen: the communication blocks if the receive queue is full. Behavior of write and read Behavior of write and read Monday, February 06, 2012 1:11 PM Docsity.com

reliable, unreliable, or reliable but possibly garbled. About whether packet delivery is reliable, unreliable, or reliable but possibly garbled. About whether acknowledgement of message delivery is Everything we are going to do in this lecture is based upon assumptions: Assumptions and Protocol Design Monday, February 06, 2012 1:25 PM Docsity.com

Basic state machine: reliable channel Reliable channel state machine Thursday, September 22, 2005 7:56 AM Docsity.com

 drop a packet.  garble a packet so it is unusable. Unreliable channels can  sender sends packet If checksum is OK, send an ACK (acknowledgement)

If checksum is not OK, send a NAK (no acknowledgement)

receiver reads packet and checks checksum.

 If ACK, send next packet.  If NAK, resend previous packet.  If ACK/NAK garbled, then?  Sender reads acknowledgement Synthesizing reliability: guaranteed delivery, possibly garbled data Not sophisticated enough: 1/2 of speed of the real algorithm. Unreliable channels Thursday, September 22, 2005 8:15 AM Docsity.com

Assumptions: reliable delivery, unreliable data packet = wrap_packet(dequeue()) send(packet); recv(ACK or NAK or garbled) do { } while (NAK or garbled) if (!empty()) { } In sending driver: while(packet=recv()) { send(ACK); if (good(packet) /* checksum */) { In receiving driver: data = unwrap_packet(packet); } else { send(NAK); } enqueue(data); } A naïve TCP implementation Thursday, September 22, 2005 8:15 AM Docsity.com

Problem: If I receive packet 1, and I ACK packet 1, and the ACK is garbled, then sender resends packet 1 and I think I'm getting packet 2! Solution: Every packet has a serial number that determines where it fits in the sequence. Sequencing Sequencing Monday, February 06, 2012 1:23 PM Docsity.com