IK2218 Transport Layer

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/53

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 1:25 PM on 10/10/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

54 Terms

1
New cards

Transport Layer Purpose

Purpose is logical process to process communication

2
New cards

Transport layer

Provides service to the applications - implements service models widely used by applications. Uses the service of the network layer - IP datagram service.

3
New cards

(Semi-) Simplex & Duplex

Only send data one direction. Semi-simplex can send data both directions, but not simultaneously. Full-Duplex can send both directions simultaneously

4
New cards

Mux-Demux - Multiplexing

Multiplexing is at sender side. UDP for example accepts messages from different processes, differentiated by their assigned port numbers and adds the header.

5
New cards

Mux-Demux - Demultiplexing

Demultiplexing is reciever side. After error checking and dropping header deliver each message to correct process based on the port numbers.

6
New cards

Socket

IP address and port number

7
New cards

Three groups of port numbers

  • 0 -1023 - well known ports. Assigned and controlled by IANA- Normally for servers / services

  • 1024-49151 - Registered ports. Registered by IANA - non-excliusive. Normaly for apps

  • 49152-65535 - Dynamic ports. Ephemeral, can be used by any process, typically client processes.


8
New cards

User Datagram Protocol (UDP)

Best-effort datagram service. Connectionless, message-oriented and unreliable. Provides error detection, multi and demultiplexing.

9
New cards

Message Oriented

Messages are sent in chunks and are recieved in the same chunks

10
New cards

Unreliable service

Sender wont know if data is recieved

11
New cards

UDP Mux/Demux

UDP data delivery is based on reciever port number and reciever IP address

12
New cards

UDP Segment Format

UDP header is 8 bytes. First is src port 2 byte, dst port 2 byte, udp length 2 byte and 2 byte UDP checksum

13
New cards

UDP Error Detection

Uses UDP checksum and ones complement. Coveres the pseudo-header, header and application data padded to be multiple of 2 bytes. Checksum optional in IPv4 (set all 0’s checksum field), mandatory in IPv6 since no error detection at network layer.

14
New cards

UDP Pseudoheader

4 byte src IC, 4 byte dst IP, 1 byte all 0, 1 byte protocol and 2 byte UDP length field.

15
New cards

UDP-lite

Replace UDP length field with checksum coverage field. Useful for multimedia where some corruption can happen, coverage ensure important part not corrupted.

16
New cards

TCP Service Model

  • Connection-oriented

  • Between EXACTLY two endpoints

  • Full-Duplex

  • Reliable and in-order

  • Byte Stream Service


17
New cards

Byte Stream Service

Stream of 8-bit bytes are transmitted over TCP connection

18
New cards

TCP functions

  • Multiplexing/Demultiplexing

  • Segmentation

  • Error Control

  • Flow Control

  • Connection Management

  • Congestion Control


19
New cards

TCP Mux/Demux

TCP conneciton identification is based on reciever port, IP AND sender port, IP.

20
New cards

TCP Segmentation

Data arrives and is delivered as byte stream. There is a buffer sender and reviever side. Try to send as big segments as possible and need one buffer for each TCP connection. Convert the bytestream into datagram segments using buffer.

21
New cards

Maximum Segment Size (MSS)

Largest chunk of data TCP will send to other side. Can be announced in option field of TCP header. IPv4 default 536 bytes, IPv6 default 1220 bytes of data for 1280 MTU.

22
New cards

Error Control

Provide reliable transmission over error prone channel. Error-prone channel can be noise causes bit error causes packet corruption causes packet drop or congestion causes packet drop. Can use Automatic Repeat Request (ARQ) either with ACK - communicate data recieved or NACK - Expected data, didnt get data.

23
New cards

Propagation vs Transmission

How long to transmit L bits with bandwidth B bits/sec, length P meters, v m/s? P/v is propagation time, L/b is transmission time. The total is the sum of the two.

24
New cards

Stop-and-wait

Start with data 0 and alternate with 0 and 1 for data number. Start a timer, if data i doesnt get Ack i before timeout then retransmit data i again. Pro is simple operation and only need m = 1 bit counter to detect duplicate data & ACK. Reciever needs no buffer. Has pad performance, Util is L/B/(RTT + L/B)

25
New cards

Go-Back-N

Sort of like stop & wait but more parallell. N is how many messages can be sent before ACK. Can’t have as many sequence numbers as N. Needs m-bit counter to avoid duplicates, then need N <= 2^m-1. No buffer needed in reciever. Util is now min(1, N*L/B/(RTT+L/B)). (N = 3 Example data 0,1,2 sent, data 0, 1 ACK and sends 3, 0 then but eventually 2 timesout. Then retransmit 2 AND 3 and 0 and continue from there)

26
New cards

Selective Repeat-N

More complex Go-Back-N. Need m bit counter to avoid duplicate and sender window N <= 2^(m-1). Reciever also needs a same size buffer to store out-of-order packets. Instead of cummulative ACK, use ACK for each individual packet and only retransmit packets that aren’t ACK’d instead of retransmit everything after aswell. Only improves performance if data is lost.

27
New cards

Reliability in TCP

Purpose is providing reliable transmission over datagram channel. Solution is Go-Back-N with cumulative ACK & reciever side buffering. Does not discard data unless its duplicate.

28
New cards

TCP Reliability - Sender Side Operation

  • Breaks app data into segments.

  • Assign sequence number to every byte

  • Create e2e checksum of the header and data

  • Start timer for each sent segment

  • Wait for ACK

  • if ACK not recieved before timeout (RTO), retransmit segment


29
New cards

TCP Reliability - Reviever Side Operation

  • Verify e2e checksum of header and data, discard if wrong.

  • Send cumulative ACK when it recieves data

  • If necessary, reorder data and discard duplicate data


30
New cards

Retransmission Timer

Retransmission Time-Out(RTO): Time to wait for ACK. Cannot be fixed for all connection and segments in a connection. RTO calculated dynamically based on measured RTT. Use binary exponential backoff, double RTO for each retransmission, if RTO gets to 1-2 minutes terminate connection.

31
New cards

RTO Calculation

  • RTTvar[k+1] = (1-B)*RTTvar[k] + B*|sRTT[k]-mRTT[k]|

  • sRTT[k+1] = a*sRTT[k]+(1-a)*mRTT[k]

  • RTO = sRTT[k+1]+4*RTTvar[k+1]


32
New cards

Karns Algorithm

Scenario is when segment is not ACK’d and retransmitted. When ACK is recieved sender doesn’t know if ACK was for original segment of the retransmitted segment. Karn’s algorithm is to not consider the RTT of a retransmitted segment and don’t update RTT value until you get an ACK without need for retransmission.

33
New cards

TCP Flow Control

Ensure reciever not overwheled with data from sender. Control the data amount sender can send before ACK recieved.

34
New cards

TCP Sliding Window Protocol

Window controls the amount of unACK’d data in the network. Do this for each TCP connection in each direction. Reciever offers window together with ACK. This says how much data it can recieve beyond what was ACK’d. Can be 0, then sender waits for window update with offer window size > 0. The sender can maintain usable window, data it can send immediately.

35
New cards

Persistance Timer

Periodically send window probes to find out if window size has increased example every 60 seconds. This is since a scenario that is bad is reciever annouces RWND = 0, so sender stops and waits. Then reciever sends ACK and RWND > 0 which gets lost. Then sender waits for the ACK and reciever waits for data, which is solved by persistance timer.

36
New cards

Delayed ACK

Do not send ACK immediately. Send atleast one ACK per two full-size segments. Delay must be less than 500 ms, typically >= 200 ms. This reduces ACK traffic and more chances you can piggyback data on ACK. Key is retransmission timer should not be triggered.

37
New cards

Silly Window Syndrome (Sender initiated)

Problem is a slow sender application. Example 1 byte sent per keystroke. So 1 datagram (41 bytes) for each 1 byte of user data (tinygram). This adds alot of congestion on WANs. Solved by Nagle’s Algorithm

38
New cards

Nagle’s Algorithm

Solves Sender Willy Window Syndrome. TCP connection can only have on unACK’d tinygram. Data accumulates while waiting and sent as one segment when ACK arrives, or when MSS can be filled. The faster ACKs come, the more often data is sent.

39
New cards

Silly Window Syndrom - Reciever Initiated

Problem is a slow reciever app. Sender sends big segments but recieving app consumes data slowly so buffer gets full. Reciever window size gets announced for each byte read from buffer if it reads 1 byte at a time then. Solved by Clark’s Solution

40
New cards

Clark’s Solution

Solution to Silly Window Syndrome - Reciever Initiated. Do not advertise small increments of RWND size. Increment atleast by MSS or ½ reciever buffer size.

41
New cards

Self-Clocking

When bulk-sending data eventually the sending rate will adjust to the slowest link bottleneck.

42
New cards

Bandwidth-delay product

Capacity of the pipe. Capacity = Bandwidth * RTT. RWND should be higher or it will not be fully utilized.

43
New cards

TCP Connection Establishment

Uses three-way handshake to establish connection. The three-way handshake guarantees both sides ready to transfer data and allows both side to agree on ISN, MSS and window size in the ACK messages. ISN must be chosen so each incarnation of a specific TCP connection between two end-points has different ISN.

44
New cards

Three-Way Handshake - Establishment

Client sends SYN packet with SYN seq = x. Server then responds with their own syn message SYN seq = y, ACK x+1 to also acknowledge the client SYN and send RWND. Then client finally responds with seq = x+1, ACK y+1 to ACK server SYN, ACK. Then can send data.

45
New cards

Keepalive Timer

Prevent TCP connection existing forever. (Ex. client connects, transmits then crashes. Connection would stay active and consume resources). Solution is TCP gets keepalive time-out after some time, usually 2 hours. Afterwards server probes client ex. 10 probes each 75 seconds. If no response, tear-down connection.

46
New cards

TCP Connection Teardown

TCP client gets close command from client process, sends FIN, seq = x to TCP server. TCP server sends ACK (seq=x+1) of FIN and deliver EOF to app. When app closed, Server sends ACK (seq=x+1), FIN, seq = y. Then finally TCP client sends ACK (seq=y+1) of FIN and then the connection is closed

47
New cards

Time-Wait Timer

Connection is held in TIME-WAIT state while closing. When FIN or ACK of FIN is sent Time-Wait Timer started which is twice the maximum lifetime of segment. if ACK or FIN gets lost then it is retransmitted when timer expires. This is done since server can’t close the connection until it recieves ACK of FIN. Typically MSL = 0,5 to 2 minutes (IP TTL limit)

48
New cards

Congestion

If router recieves packets faster than it can process then packets get dropped. Packets need a buffer to decrease drop rate. Delay and missing ACK’s cause retransmission which will add to congestion which leads to network collapses. Window size must therefore depend on networks state aswell.

49
New cards

Congestion Window

Maintained by the sender and updated in response to losses / delay. Sender maintains 2 window sizes, Reciever-advertised window (RWND) and Congestion Window (CWND). The actual window size is the min(RWND, CWND). There are two phases, slow start and congestion avoidance.

50
New cards

Slow Start Phase

All TCP operations MUST implement slow start. Operation: At beginning of connection, CWND <= [1..4] x MSS. For each incoming ACK: CWND += min(N, MSS) where N is the new data (in bytes) acknowledged by ACK. Window size grows exponentially, but with delayed ACK it slows down since its bound by MSS.

51
New cards

Congestion Avoidance phase

Increase CWND additively. On every acked byte, CWND += MSS/CWND (+1 MSS per RTT). Linear growth continues until RWND is reached or ACK timeout occurs which TCP assumes is congestion. Upon timeout (TCP Tahoe), ssthresh = CWND/2 and set CWND = 1 MSS (enter slow start). As for choice of ssthresh, initial value 65535, minimum value 512 bytes.

52
New cards

TCP Reno

Problem is out of order and losing single segment can trigger slow start. Solution is TCP Reno. Generate immediate ACK when out of order segment recieved. If 3 or more duplicate ACKs in a row, retransmit immediately (Fast Retransmit) and do congestion avoidance phase (Fast recovery). Set CWND to ssthresh + 3*MSS after halving ssthresh. When new data is ACK’d, set CWND = ssthresh.

53
New cards

TCP Throughput Model

Congestion avoidance phase only, using Fast Recovery. Approximate using constant RTT and maximum window size W. Then R = MSS ¾ * W/RTT

54
New cards

TCP Segment

2 byte source port, 2 byte dst port, 4 byte sequence number, 4 byte ACK number, 4 bit header length, 6 bit reserved, 6 bit flags, 2 byte window size, 2 byte TCP checksum, 2 byte urgent pointer, options (if any), data (if any).