GoalExplain what a protocol is, say what TCP and IP each do, and put the three messages of a handshake in order.
New words
protocol · a set of rules that devices follow so that they can communicateTCP/IP · a group of protocols: IP finds the right device by its address and TCP makes sure the packets arrive safelyhandshake · a short exchange of messages that sets up a connection before any data is sentacknowledgement (ACK) · a message that confirms that something has been received
Explanation
Two devices can only share data if they follow the same rules. A set of such rules is called a protocol, like two people agreeing to speak the same language. TCP/IP is a suite of protocols used on the internet: IP uses the IP address to send each packet to the right device, and TCP checks that all the packets arrive safely so that the file can be rebuilt. Before any data moves, the two devices make a handshake with three messages. First, the device that wants to send sends SYN (a synchronisation message). Second, the receiver answers with SYN/ACK, which confirms the request and says whether it is ready. Third, the first device sends ACK to confirm that it got that answer. Then the data can start if the receiver is ready.
Step
Message
Sent by
What it tells the other device
1
SYN
the device that wants to send
‘I would like to send you data.’
2
SYN/ACK
the device that receives
‘I got your request, and I am ready (or not ready).’
3
ACK
the device that wants to send
‘I got your answer.’
Worked examples
Step
From
To
Message
1
198.51.100.7 (laptop)
203.0.113.9 (server)
SYN
2
203.0.113.9 (server)
198.51.100.7 (laptop)
SYN/ACK
3
198.51.100.7 (laptop)
203.0.113.9 (server)
ACK
A handshake with addresses. A laptop at 198.51.100.7 wants to send a file to a server at 203.0.113.9. Three short messages go back and forth before any of the file moves. Only after step 3 can the file start.
Protocol
Its job
The question it answers
IP
delivers each packet to the device with the matching address
Where does this packet go?
TCP
makes sure the packets arrive safely
Did everything arrive?
The two jobs. A 12-page report is sent to another computer. IP puts the receiver’s address on every packet so that the packets are delivered to the right device. TCP looks after the safe delivery, so that every packet arrives and the report can be put back together. The two protocols work as a pair.
A handshake with a busy receiver. A tablet sends SYN to a server. The server’s SYN/ACK says that it is not ready yet. The tablet’s ACK only confirms that it got this answer. The tablet holds back the data and waits until the server is ready.
Class activity
Card handshake (no computer). Two players are two devices. Player 1 holds a card marked SYN. Player 2 answers with a card marked SYN/ACK and shows a thumb up (ready) or a thumb down (not ready). Player 1 replies with a card marked ACK. Only after the three cards may Player 1 read out four numbered paper strips (the packets) from a short message, and Player 2 puts them in order. Play again with a thumb down: what must Player 1 do with the strips?
Practice
1
Fill in the three missing messages of this handshake.
Step
From
To
Message
1
192.0.2.40 (phone)
203.0.113.21 (server)
?
2
203.0.113.21 (server)
192.0.2.40 (phone)
?
3
192.0.2.40 (phone)
203.0.113.21 (server)
?
Step 1 is SYN, sent by the phone. Step 2 is SYN/ACK, sent by the server. Step 3 is ACK, sent by the phone.
2
Put these four events in the correct order: (a) the server sends SYN/ACK; (b) the file is sent; (c) the phone sends SYN; (d) the phone sends ACK.
The order is c, a, d, b. The file (b) is only sent after the handshake of three messages is complete.
3
A learner writes: ‘TCP finds the right device by its address, and IP makes sure the packets arrive safely.’ Correct the sentence.
The jobs are the other way round. IP uses the address to find the right device, and TCP makes sure the packets arrive safely.
4
The server’s SYN/ACK says ‘not ready’. Does the phone start to send the file straight away? Explain.
Step
From
To
Message
1
phone
server
SYN
2
server
phone
SYN/ACK: not ready
3
phone
server
ACK
No. The phone’s ACK only confirms that it received the answer. The phone holds back the data and waits until the server is ready, because a handshake is there to check that the receiver can accept the data.