Week 2 Transport layer Flashcards
What is multiplexing
2 hosts being able to communicate simultaneously
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