class_notes

  • The TRANSPORT layer establishes the transmission process between two devices.
  • The basic services in the transportation layer are:
    • Segmentation and re-assembly (Limiting PDU size).
    • Multiplexing and Demultiplexing (assign Port numbers to allow multiple applications to run at the same time).
    • Error detection (no correction).\

Flow control methods:

Stop and wait:

  • The transmitter sends the segment and waits for the receiver’s acknowledgment (ACK) before sending the next segment.
  • There is a timer to detect if we lost a segment (No ACK received).
  • It wastes time but is reliable for error detection.

Pipeline:

  • The transmitter sends several segments at the same time before waiting for an ACK.
  • It uses the “Sliding window method”.

Sliding Window:

  • The Receiver can receive N segments in a row. therefore the sender will take advantage of that and several segments together.
  • The segments are numbered. So that we can know what segment got received and what segment got lost during the transmission.
  • When the transmitter receives an ACK(n) means all segments up to segment number n-1 have been successfully received.

Go-Back-N:

  • Sliding window flow control combined with a reliability mechanism.
  • If there are no errors, the protocol rolls back to a sliding window of size N.
  • The receiver must acknowledge each segments by sending an ACK(n).
  • If the receiver get segment n+1 but not n, it ignores segment n+1 and sends an ACK(n) or NACK(n), letting the sender know to resend the segments starting from n. (this is why it’s called Go-Back-N).
  • Like stop and wait, a timeout is also required.

Selective repeat:

  • similar to Go-Back-N, but the transmitter sends only the lost segments.
  • Fewer retransmission than Go-Back-N in case of errors.

TCP:

  • connection oriented
  • flow control
  • reliable
  • same order delivery
  • congestion control

ACK:

  • TCP acknowledges the received bytes.
  • Expectational ACK: destination sends an ACK containing the expected sequence number.
  • Cumulative ACK: all segments before the ACK has been received successfully (Used in sliding window).

Handshake:

  • TCP uses handshakes to establish a connection between 2 devices.
  • A three-way handshake is one type/protocol of handshake
How three-way handshake works:
  • client send SYN (synchronization) packet, to request a connection and send its initial sequence number.
    Client → Server : SYN
  • server respond by sending a SYN and ACK, to confirm the synchronization and sends its own sequence number.
    Server → Client : SYN + ACK
  • the client then sends back an ACK , to confirm the synchronization sent by the server.
    Client → Server : ACK
How to close a TCP handshake:
  • client send FIN packet, saying “i want to terminate the connection”.
    Client → Server : FIN
  • server respond by send ACK and FIN, to confirm the termination and sends it own FIN.
    Server → Client : ACK
    Server → Client : FIN
  • Client send back ACK, to close the connection completely.
    Client → Server : ACK

Flow control and Reliability:

  • TCP uses something similar to Go-Back-N
  • The application may be slow when reading from the buffer. So the transmission speed and transmission window must be adapted to the receiving application’s draining speed.
  • ACKs are Cumulative
  • TCP uses a single timeout timer, that is associated with the oldest unacknowledged segment
  • When the timeout expires, only the one unacknowledged segment is retransmitted.

;

  • After timeout, the segment is retransmitted and the timeout value is doubled.

Congestion control:

  • Network congestion is when too much data is sent into the network at the same time. this can overwhelm the receiver which result is discarding some packets.
  • TCP reacts to segment loss by reducing its transmission rate.
  • Its transmission window is controlled by the receiver’s capacity and the network status.
  • CWND = congestion window, controlled by the sender - prevent congestion in the network itself.
  • RWND = receive window, controlled by the receiver - prevent the sender from overwhelming the receiver’s buffer.
  • Sender must obey both RWND and CWND. So it takes the .

TCP slow start:

  • When a TCP connection begins, the value of the congestion window (CWND) is typically initialized to a small value of 1MSS
  • Meaning and resulting an initial rate of
  • When it receives an ACK, the TCP sender increase the congestion window by 1 MSS. Then by 2, 4, 8, 16, …
  • So the send rate grows exponentially in the SS phase.
  • when we pass a certain threshold (SS-threshold),the send rate is increased by 1 (linear) to avoid congestion.

IDK:

  • In the congestion avoidance phase, if we get a packet loss, we reset the sending rate to slow start (for Tahoe TCP), or we use fast recovery and reset it to the threshold (for reno TCP)

MSS: maximum segment size
RTT: rout—trip time
L: loss rate
TH: throughput

UDP:

  • connectionless
  • Simple
  • unreliable