Looks like no one added any tags here yet for you.
What is the difference between IP and TCP?
TCP is connection-oriented, meaning it needs traffic to be routable in both directions between 2 hosts
How are TCP connections uniquely identified?
Through sockets
How can TCP communicate?
Through ports and sockets
Multiplexing
2 hosts can have more than 1 conversation simultaneously
TCP flow
Identified by a 4-tuple
- Source IP address
- Source port number
- Destination IP address
- Destination port number
Socket
Combinations of an IP address, and a TCP port number
Who maintains the list of assigned TCP ports?
IANA
TCP header
- 32 bits wide
- Includes source and destination port
- Header has a mandatory 20 bytes as well as optional extensions
- Sequence number
- Acknowledgement number
- Window size
- Flags e.g SYN, ACK, FIN
How long is a port?
16 bits long
What is the maximum value a port can have?
2^16 - 1
What is the sequence number used for in a TCP message header?
- For order + reassembly
- It is the number assigned to the first data byte of a segment
What is the acknowledgement number used for in a TCP message header?
- For reliability
- It is next sequence number that the sender of the ACK message expects (or the sequence number + 1)
What is the window size used for in a TCP message header?
- For flow control
- It is the number of bytes a receiver can get
Where is a TCP message encapsulated in?
An IP message
What is the client/server model?
- A server is a host that is ready to accept communication on 1+ ports
- A client is a host that initiates communication with a server
TCP connection setup/ 3-way handshake
1. Client synchronises with server (SYN)
2. Server acknowledges synchronise (SYN ACK)
3. Client acknowledges server acknowledgement (ACK)
4. Connection is set up
TCP connection tear-down
1. Client sends finalise (FIN)
2. Server acknowledges finalise (ACK + FIN)
3. Client acknowledges acknowledgement (ACK)
4. Connection closes
TCP segment
Data that has been divided into chunks and had a TCP header added to it
What can a host do to avoid data fragmentation in the IP layer?
Add a maximum segment size to the TCP header
What is a maximum segment size?
The largest IP datagram a host can handle MINUS the IP and TCP header sizes
What is the equation that links MTU and MSS together?
MSS = MTU - 40
- 20 bytes for the IP header
- 20 bytes for the TCP header
In what types of segments is the MSS value sent?
In SYN segments
What is the default value for MSS?
536 bytes
Is the MSS value negotiated between hosts?
No! Each host dictates the MSS for its receiving direction of flow
Types of TCP reliability mechanisms
- Duplicate acknowledgement retransmission
- Timeout-based retransmission
Duplicate acknowledgement retransmission
- Acknowledgement numbers sent for each ACK segment are cumulative
- If a segment is lost, the receiver will acknowledge the same segment over and over again until the info in the lost segment is received
- The sender interprets this as packet loss
Timeout-based retransmission
- When a sender sends a segment, it starts a timer
- If the timer runs out before an ACK is received, the segment is sent again
What concept is associated with the window size header?
Sliding window approach
What is the sliding window approach?
- When a TCP segment is received, the window size value is read
- The sender cannot send any bytes past this window size until an ACK segment is received
- When an ACK segment is received, the window size is updated according to the receiver's capacity
What happens when TCP sequence numbers and window sizes overflow?
The number rolls back to 0
What happens when a sender receives a window size of 0?
The sender stops sending data
After a sender receives a window size of 0, what is the name of the timer that begins?
Persist timer
What is a persist timer?
- Used to time elapsed time after window size of 0 is sent
- Checks if 0 was sent on purpose or because of lost/corrupt segments
- When timer expires, small empty segment sent so that receiver sends another acknowledgement
What is congestion?
When the amount of traffic within a network overwhelms router buffers
Congestion vs flow control
Congestion concerns router buffers, whilst flow control concerns receiver buffers
What does congestion cause?
- Long delays
- Packet loss
- Decreased throughput due to more unneeded and duplicate retransmissions
Approaches to congestion control
- End-end (Do nothing)
- Network-assisted (Feedback to hosts)
What is a type of TCP congestion control?
Additive Increase Multiplicative Decrease (AIMD)
What is Additive Increase Multiplicative Decrease (AIMD)?
- Senders can increase sending rate slowly until segment loss occurs, in this case, decrease sending rate quickly to isolate issues
What is TCP Slow Start?
- An algorithm used to increase from initial sending rate of 1 MSS exponentially after every round trip until loss
- This occurs until a threshold amount, and then additive increase starts
When segment loss occurs, how does AIMD decrease sending rate?
AIMD cuts sending rate in half at each loss event
What is the rate of additive increase in AIMD?
1 MSS every round trip time (RTT)
Naming concerns
- TCP itself doesn't treat port numbers specially, but IANA sets well-known port numbers for different applications to be easily identifiable e.g http = 80, https = 443
- Ports 49152 - 65335 are unregistered for dynamic/private ports
Session/state concerns
- TCP is connection-oriented, meaning that a state transition machine captures both client and server states
- Messages can be sent as long as session is open
Security concerns
- No security features, all header and payload details are visible
- Transport Layer Security (TLS) aims for end-to-end security
- Attacks include TCP reset attacks, TCP connection hijacking, TCP SYN floods
Reliability concerns
- Considered reliable due to timeouts and acknowledgements meaning everything transmitted will be delivered eventually
- TCP checksums can detect errors in payload
Scalability concerns
- TCP benefits from IP scalability
- TCP connection setup time can affect performance
Management concerns
- No real management issue apart from applications being able to choose their own ports locally
Governance concerns
- Internet Engineering Task Force (IETF) standardise and govern TCP
- IANA maintain official assignments of port numbers
Description concerns
Transport layer is not self-describing nor queryable
What is User Datagram Protocol (UDP)?
- Second transport layer
- Used by apps that don't need guaranteed delivery of TCP
What does UDP do differently from TCP?
- Takes app data and creates UDP datagram and sends this to network layer
UDP header
Only 4 headers
- Source port
- Destination port
- Checksum
- Length
What are the properties of UDP?
- Connectionless
- Datagram service, meaning packets show up in no order
- Self-contained datagrams
- Unreliable delivery
HTTP request structure
1. Start line
2. Properties
HTTP response structure
1. Start line
2. Headers
3. Body
What is a URI?
- Uniform Resource Identifier
- Compact string of chars for identifying a resource
- Clients don't look at URI content
Resource naming hierarchy
- Internationalised Resource Identifier (IRI) is the superset
- Uniform Resource Identifier (URI) is a subset of IRI and a general version of different naming conventions
- Uniform Resource Locator (URL) and Uniform Resource Name (URN) are subsets of URI
What is the web architecture?
A network of named resources
What is a resource?
- Anything with an identity
- Can be retrievable e.g a document, non-retrievable e.g a book, or abstract e.g relationships
What does the web architecture define?
An interface to interact with resources via HTTP
What is a representation?
- Information that is intended to reflect a past, current, or desired state of a given resource
- In a format that can be communicated via protocols
Relationship between resources and representations
- Named resources are represented by representations
- Representations are an abstraction needed to represent the state of a resource during communications