TCP
Transmission Control Protocol (TCP/IP)
- Designed in conjunction with IP
- Interface to services
- Port
- A server could be running different number of services, you can port scan it, for example use an utility called
nmap
- Reliable delivery
- The goal of TCP/IP
- Error checking
- Congestion avoidance
- How much data are you sending at once?
- When you ride a car you do not instantly go to 100 mph you start slow then accelerate then slow down
- Speed of transfer data may vary
TCP header
/CAP/Network+/Visual%20Aids/Screenshot%202025-01-13%20at%2011.55.14%20PM.png)
- The sequence numbers change over the lifetime of the connection
- They changed based on how much data is sent.
Three-way Handshake
- Synchronization before transportation
- The sequence number is so that if packets arrive out of order we can put them back in order
- Data comes and is assembled even if specific data segments are lost, TCP will detect it and will retrieve that data again.
- SYN
- Synchronization request
- Let's say we put it in port 22
- SYN, ACK
- I acknowledge the SYN you just sent me
- Here is my SYN number (SYN-1024)
- ACK
- Is that ok to follow?
/CAP/Network+/Visual%20Aids/Pasted%20image%2020250114000317.png)
RST and FIN flags
In TCP (Transmission Control Protocol), the FIN and RST flags are used for managing the state of a connection:
- FIN (Finish):
- Indicates that the sender has finished sending data and wants to gracefully close the connection.
- When a device sends a FIN flag, it is signaling the end of data transmission, and the other device should acknowledge it by sending an ACK (Acknowledgment) back.
- This is part of the four-way handshake for closing a TCP connection.
- RST (Reset):
- Indicates that the connection should be immediately reset or aborted.
- Typically used when there is an error, such as a non-existent port, or when a device wants to abruptly terminate the connection for some reason.
- Unlike FIN, which is part of the graceful termination process, RST abruptly ends the connection without the normal handshakes.