IPA FE Subject A sample Question 29
A question IPA Japan published in 基本情報技術者試験 科目A サンプル問題 問29, translated into English. ITPEC is based on the same exams.
Same question on ITPEC: Mar 2018 Q35
A PC and a web server are communicating via HTTP. When a request packet is sent from the PC to the web server, which of the following combinations of port numbers does the response packet have? Here, the source and the destination port numbers of the request packet are 50001 and 80 respectively.
Explanation
Source 80, destination 50001 — the response swaps the request's source and destination ports.
A TCP connection is identified by the two addresses and the two ports. The PC opened it from its ephemeral port 50001 to the web server's well-known port 80. Every packet the server sends back on this connection comes from port 80 and goes to port 50001, so the PC can match the response to the request.
Answer (a)
Why not others:
- •(b) 50001, 80 — copies the request's ports unchanged, which would address the response to the server's own HTTP port
- •(c) — the server replies from the port the connection was opened on, 80, and the response must go to the PC's port 50001, not to 80
- •(d) — the destination 50001 is right, but a new source port would not match the existing connection, so the PC would not accept it as the reply
Key rule: In a request and its response the ports simply swap: the server always answers from its well-known port to the client's ephemeral port.
Networks · AI-written, may contain errors
This question comes from the past questions IPA Japan publishes, translated into English by ITPEC Practice. ITPEC Practice is an independent study tool and is not affiliated with IPA or ITPEC. See the original paper (PDF) or Report an issue.