Transmission Control Protocol (TCP)

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Transmission Control Protocol (TCP)

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which protocol sets up a connection, numbers the data and checks every packet arrived?
A UDP
B TCP
2. What is the three-way handshake used for?
A Setting up a TCP connection before data is sent
B Encrypting data so hackers cannot read it
3. Why does TCP give each packet a sequence number?
A So the packets travel faster across the network
B So the packets can be put back in the right order
4. A receiver gets packets 1, 2 and 4, but packet 3 never arrives. What does TCP do?
A The missing packet 3 is sent again
B The data is used as it is, with packet 3 missing
5. What does an acknowledgement (ACK) tell the sender?
A The packet arrived safely
B The packet must be deleted

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1SYN, SYN-ACK, ACK ATCP always sets up a connection first with the three-way handshake (SYN, SYN-ACK, ACK) before sending data.
2ACK 5 BHTTP -> TCP, SMTP -> TCP
3TCP numbers each packet so the receiver can put the data back in the correct order Cseq = 1, 2, 3, 4
4TCP is used by web pages and email because they need all the data to arrive complete DTCP notices the missing packet because no ACK comes back, then the sender resends it so the data is complete.
5TCP sends data straight away without any handshake EThe three-way handshake: the two devices agree to connect before any data is sent
6A packet is lost, so TCP ignores it and carries on FAn acknowledgement telling the sender that the data up to packet 4 arrived and packet 5 is expected next

Definitions

TCP

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
client -> server: ___ server -> client: SYN-ACK client -> server: ACK
2.
send(packet, seq=1) send(packet, seq=2) send(packet, ___=3)
3.
if noAck: ______(packet)
4.
webPage.protocol = ___ email.protocol = TCP
5.
seq = 5 ack = seq _ 1

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A SYN: server -> client
B SYN-ACK: server -> client
C ACK: client -> server
Question 2
A client sends SYN
B server ignores the SYN
C client sends ACK
D data transfer begins
Question 3
A packet 1 = seq 1
B packet 2 = seq 1
C packet 3 = seq 3
Question 4
A send packet 4
B start timer
C if ACK arrives before timeout:
D resend packet 4
Question 5
A TCP: send without a connection
B number every packet
C resend any missing packet

Answer Key

Transmission Control Protocol (TCP)
Section A: Quick Questions
Q1
B — TCP
Q2
A — Setting up a TCP connection before data is sent
Q3
B — So the packets can be put back in the right order
Q4
A — The missing packet 3 is sent again
Q5
A — The packet arrived safely
Section B: Match the Pairs
Q1
SYN, SYN-ACK, ACK → The three-way handshake: the two devices agree to connect before any data is sent
Q2
ACK 5 → An acknowledgement telling the sender that the data up to packet 4 arrived and packet 5 is expected next
Q3
TCP numbers each packet so the receiver can put the data back in the correct order → seq = 1, 2, 3, 4
Q4
TCP is used by web pages and email because they need all the data to arrive complete → HTTP -> TCP, SMTP -> TCP
Q5
TCP sends data straight away without any handshake → TCP always sets up a connection first with the three-way handshake (SYN, SYN-ACK, ACK) before sending data.
Q6
A packet is lost, so TCP ignores it and carries on → TCP notices the missing packet because no ACK comes back, then the sender resends it so the data is complete.
Section C: Definitions
Q1
TCP — Transmission Control Protocol. It sets up a connection, numbers packets, checks each one arrived and resends any missing, so data arrives complete and in order. Web pages and email use it.
Section D: Fill in the Blanks
Q1
client -> server: SYN server -> client: SYN-ACK client -> server: ACK
Q2
send(packet, seq=1) send(packet, seq=2) send(packet, seq=3)
Q3
if noAck: resend(packet)
Q4
webPage.protocol = TCP email.protocol = TCP
Q5
seq = 5 ack = seq + 1
Section E: Spot the Error
Q1
A — In the three-way handshake the client starts by sending SYN to the server. It should be 'SYN: client -> server'.
Q2
B — The server must answer the client's SYN with a SYN-ACK to carry on the handshake. It should be 'server replies SYN-ACK'.
Q3
B — TCP gives each packet its own sequence number, counting up. Packet 2 should have seq 2, not a repeated seq 1.
Q4
C — TCP only resends a packet when no acknowledgement arrives before the timeout. It should be 'if no ACK before timeout:'.
Q5
A — TCP is connection-oriented, so it sets up a connection with the three-way handshake before any data is sent.