Week 2 Transport layer Flashcards
What is multiplexing
2 hosts being able to communicate simultaneously
aim of tcp
.deliver packets between processes
. segmentation
. reliable delivery
. flow control
What key components are inside the TCP message header?
Key Components of the TCP Header:
Source Port: Identifies the sender’s port.
Destination Port: Identifies the receiver’s port.
Sequence Number: Number assigned to the first byte of the current data segment — used for ordering.
Acknowledgment Number: Indicates the next byte expected by the receiver (1 + last byte acknowledged) — used for reliability.
Window Size: Number of bytes the receiver is prepared to accept — used for flow control.
What are the features of tcp that allow it to get to its function
Function Segmentation - segments broken down according to Maximum segment size
RELIABILITY - acknowledgement no - allows us to determine the last byte received which is useful when detecting lost packets and corruption etc
flow control - window size tells us how much more data receivers buffer can handle
2 main ways TCP Handles packet Loss
. Duplicate ACK
. timeout
explain duplicate ack
there is an example there too
Duplicate ACKs occur when the receiver receives segments out of order or a segment is lost.
The receiver sends an ACK for the last in-sequence byte it received correctly.
When the sender receives 3 duplicate ACKs (4 total ACKs for the same sequence number), it triggers Fast Retransmit and immediately retransmits the missing segment.
EXAMPLE:
Sender sends 4 segments (each 1000 bytes):
Segment 1 (Seq 1,000–1,999),
Segment 2 (Seq 2,000–2,999),
Segment 3 (Seq 3,000–3,999),
Segment 4 (Seq 4,000–4,999).
Segment 2 is lost (Seq 2,000–2,999).
Receiver gets Segment 1, 3, and 4, but since Segment 2 is missing:
First ACK for 2,000 (expected byte).
Duplicate ACK 1: ACK 2,000 (after Segment 3).
Duplicate ACK 2: ACK 2,000 (after Segment 4).
Duplicate ACK 3: ACK 2,000 (still waiting for Segment 2).
Sender receives 3 duplicate ACKs (4 ACKs in total for Seq 2,000) and retransmits Segment 2 immediately.
explain time out
There is an example there too
What is TCP
TCP (Transmission Control Protocol) provides reliable, ordered, and error-checked delivery of a byte stream between applications. It breaks the data into segments, each less than or equal to the Maximum Transmission Unit (MTU), ensuring efficient transmission. If any segments are lost during transmission, TCP retransmits them to maintain data integrity.
Why do you need to distinguish TCP connections
due to the concept of multiplexity , TCP connections can be sent simultaneously ( need to be able to distinguish)
fun fact lets say you are sending a request to the same server
since we know the way to distinguish involves source socket(source IP and source port) and destination socket pair(destination IP and destination port)
TCP automatically makes the source port unique ( to be able to distinguish what is essentially the same request)
what is a socket
pair of ip address and port
How to distinguish TCP connections
source socket(source IP and source port) and destination socket pair(destination IP and destination port)
uniquely distinguishes connections
functionality of transport layer
Deliver packets between
two processes
* Reliable delivery
* Segment packets
* Flow control
what is sequence number
Sequence number:
each byte of data assigned unique sequence number in ascending order, indicating position in byte stream. Each TCP segment carries a sequence number that corresponds to the first byte of data it contains, allowing the receiver to properly reassemble segments and ensure the correct order of all bytes, even if they arrive out of sequence.
Example of how sequence number works
0 1 2 3 4 5 6 7 8 9 10 11
“H E L L O , W O R L D !”
Byte Sequence Numbers:
Byte 1: ‘H’
Byte 2: ‘e’
Byte 3: ‘l’
Byte 4: ‘l’
Byte 5: ‘o’
Byte 6: ‘,’
Byte 7: ‘ ‘ (space)
Byte 8: ‘W’
Byte 9: ‘o’
Byte 10: ‘r’
Byte 11: ‘l’
Byte 12: ‘d’
Byte 13: ‘!’
TCP may segment the data into smaller pieces:
Segment 1: Contains bytes 1 to 8 (“Hello, W”)
- segment’s sequence number would be 1 [ first byte of the segment]
Segment 2: Contains bytes 9 to 13 (“orld!”)
* Sequence Number: 9 (indicating the first byte of this segment)
The segments may arrive in different order but TCP will order according to segments sequence number ( bytes in segment 1 followed by bytes in segment 2)
acknowledgement number
Acknowdgement number- indicates the next byte we need to receive
= 1 plus the byte that just came through
sequence numbers 1 to 1000.
the receiver will send an ACK with an acknowledgment number of 1001, meaning “I’ve received bytes 1 to 1000, and I’m ready to receive byte 1001 next.”
Window size
window size is how much data it can receive until buffer becomes full
Ports help distinguish between different applications running on the same host.
adns;asn
2.3 What role do routers play in a TCP connection?
Routers do not track individual TCP connections. They are stateless regarding the connection. They forward IP packets based on the IP header without knowing or caring about TCP ports.
what port is http
port 80
what port is https
port 443
Latency refers to the time it takes for data to travel from the sender to the receiver across a network.
asdmasdmn