TCP/IP
Modified 2024-04-08
The protocol includes 4 layers:
- application
- transport
- internet
- network interface
TCP Headers
| Header | Description |
|---|---|
| Source Port | The port opened by the sender to send the TCP packet from. Value is random. |
| Destination Port | The port where an application or service is running. |
| Source IP | |
| Destination IP | |
| Sequence Number | When a connection occurs, the first piece of data is a random number. |
| Acknowledgment Number | Sequence Number + 1 |
| Checksum | Receiver needs to verify the data |
| Data | The information in bytes |
| Flag | Determines how to handle the packet during the handshake process. |
Three-way Handshake
| Step | Message | Description |
|---|---|---|
| 1 | SYN | Initiates connection and synchronizes devices |
| 2 | SYN/ACK | Sent by the receiver to confirm correct synchronization |
| 3 | ACK | Acknowledges the received packets |
| 4 | DATA | |
| 5 | FIN | Properly close the connection, and possibly acknowledges |
| # | RST | Abruptly ends all communication (errors, low resources) |