Networking
Layer 4 - Transport Layer
Transport Layer
- Layer 3 - Deliver individual packets across multiple hops
- Layer 4 - Manage multiple packets
- Create a connection
- Keep packets in order
- Re-transmit lost packets
Layer 4 Protocols
- TCP - Transmission Control Protocol
- HTTP - Hyper-Text Transport Protocol
- SMTP - Simple Mail Transfer Protocol
- IMAP Internet Message Access Protocol
- FTP - File Transfer Protocol
Create a Connection
- TCP Handshake
- Step 1: Client creates a TCP Synchronize Packet (SYN)
- Packet includes a sequence number
- Step 2: Server sends back a two-in-one packet
- Acknowledgement (ACK) of SYN packet
- SYN packet with sequence, server-to-client
- Called a SYN-ACK packet
- Step 3: Client sends back an ACK packet
- Connection is now established
Create a Connection
What Is Happening Here?
ACK Packets
ACK Packets
ACK Packets - Data Loss
ACK Packets
How long does this take?
- Your "ping" time is the time for a packet to do one round-trip - client to server back to client.
- If your "ping" time is 10 ms, it takes 0.010 seconds for a round trip.
- That's about 100 data packets and 100 ACK packets.
- At 1500 bytes in an Ethernet frame, you could at most transmit 150 kBps. Or 1.2 Mbps.
- The ACK time limits your data rate to something too slow.
Improving ACKs
Sliding Window
Sliding Window Animations
- Go Back N Animation
-
Another sliding window animation
- You can click to destroy packets
- Try it out!!!
Wireshark - Sliding Window
Close a Connection
Close a Connection
What's happening?
Buffering and Sending Data
my_socket.sendall(b"1")
my_socket.sendall(b"2")
my_socket.sendall(b"3")
How is this broken into packets?
Other TCP Flags
- PSH - Push. Data was sent immediately without waiting for buffer to fill. Receiver should pass up to application layer immediately.
- RST - Reset. An unexpected packet was received. e.g. A packet for a closed socket.
PSH and RST Packet
Hyper-Text Transport Protocol
- TCP connection on port 80 (443 encrypted)
- Can transfer more than HTML
- Images (PNG, JPG, GIF)
- JavaScript
- JSON-Formatted Data
- Files
HTTP Response Codes
- 200 - OK
- 304 Not modified
- 3XX Redirect
- 404 Not found
- 500 Server error
GET /
Wireshark Following HTTP
Wireshark Following HTTP
Wireshark Following HTTP
Networking: Layer 4 Transport Layer
By Paul Craven
Networking: Layer 4 Transport Layer
- 690