a Network Protocol used to establish a guaranteed, connection-oriented communication channel between communicating devices.
A bidirectional stream protocol that delivers arbitrarily long streams of bytes
Sequence number in each direction to maintain packet order → Each connection maintains 2 sequence numbers
SYN and ACK flag bits.
3 packets at beginning of TCP connection (3-way handshake) are SYN, SYN-ACK, ACK
This handshake is the two sides exchanging randomly chosen sequence numbers to sychronize data going in both directions.
Exists in the Transport Layer Anything that wants a session with continuity uses TCP.
Stop and Wait Protocol
Send a packet. Await an acknowledgement before sending the next Packet. Repeat.
Link to original![]()
Retransmission after timeout
Because we might not get an ACK, we must buffer a packet a the sender and receiver. Use a monotonically increasing sequence number to keep track of ordering.
Go Back N
Iterating upon Stop and Wait Protocol, we use our knowledge of Pipelines to speed things up! Send
Link to originalpackets all at once. ![]()
We need
size buffers at the receiver and sender.
Sliding Window Protocol
Sliding Window Protocol allows sending multiple Packets before receiving acknowledgments.
Link to originalThe maroon packets can be sent in arbitrary order. Therein lies the optimization. See here
Segment
Creates a PDU called a “segment” which includes a TCP Header consisting of connection state information known as a “TCP flag”
Window size is size of sliding window
The only place Professor Forsyth has even seen the urgent ptr actually be used is in Ctrl-C quit over SSH.
TCP Header
a 10-field, 20-byte header containing connection and payload delivery details for a segment. A TCP header is used to establish a three-way handshake for payload delivery.
3 Way Handshake
Client sends a packet iwth random sequence number and SYN flag
Server recognizes the packet with a SYN as a request to initiate a stream. If it accepts, the it responds by
- Putting the sequence number in the acknowledgement field
- Setting the ACK bit
- putting a different random sequence number in the packet
- Setting the SYN bit before sending the packet to the client Client sends packet back with ACK field and populated data field When either are done transmitting, they send a packet with the FIN bit set, which causes the other side to no longer expect to receive packets from the stream
Retransmission after timeout
Because we might not get an ACK, we must buffer a packet a the sender and receiver.
Use a monotonically increasing sequence number to keep track of ordering.
We need 
The maroon packets can be sent in arbitrary order. Therein lies the optimization.
See