Chapter recap
A client starts each exchange; a server listens at a well-known port. An application protocol defines message types, syntax, meaning, timing and the transport it rides on (TCP for reliable exchanges, UDP for quick small ones). A TCP server holds one listening socket plus one socket per connection. P2P peers serve each other.
Practice questions
- NAT · 1 mark
A server process accepts 25 TCP connections. How many sockets does it have open (including the listening one)?
Write your answer before opening the key.
- MCQ · 1 mark
Which socket call does the server use to wait for a new connection?
- connect()
- accept()
- bind()
- send()
- MSQ · 1 mark
Which typically use TCP?
- Fetching a web page
- Sending an e-mail
- A single short name lookup
- Downloading a file
- MCQ · 1 mark
In client-server, the client port is usually:
- well-known (0–1023)
- ephemeral, chosen by the client's OS
- always 80
- the same as the server port
- NAT · 2 marks
Client-server: 100 copies of a 10⁹-bit file from a 1 Gbps server upload. Minimum time (s)?
Write your answer before opening the key.
- MCQ · 1 mark
Which layer of the 5-layer model contains application protocols?
- Transport
- Application
- Network
- Session
- MCQ · 1 mark
In P2P file distribution, adding more peers:
- always slows everyone down
- adds upload capacity as well as demand
- removes the need for any server or tracker in all designs
- makes TCP unnecessary
- MSQ · 1 mark
An application protocol must specify:
- the syntax of messages
- the meaning of fields
- the IP header format
- the order of messages
Answer key
Try the questions first. Open when you are ready to check.
- 26 — 25 + 1.
- B — accept() blocks until a client connects.
- A: Client call.
- C: Assigns the address.
- D: Sends data.
- ABD — They need every byte reliably.
- C: Short lookups use UDP by default.
- B — Clients use temporary ports.
- A: Servers use well-known ports.
- C: 80 is a server port.
- D: Not required.
- 100 — 10¹¹ / 10⁹ = 100 s.
- B — Top layer.
- A: Below.
- C: Below.
- D: Not a TCP/IP layer.
- B — Each peer also uploads.
- A: Capacity grows too.
- C: Many P2P systems still use a tracker.
- D: Peers still use TCP.
- ABD — IP headers belong to the network layer.
- C: Not the application's job.