Experiments

Week 02 · 1 / 19 · 00–03 min

What happens when you press Send?

One message. Two browsers. A whole network in between.

Predict three things that happen after you press Send.

Week 02 · 2 / 19 · 03–06 min

Last week: bits need a rule

01000001 can mean the number 65 or the letter A. A network carries bytes; an application interprets them.

What tells the receiver how to interpret the bytes?

Week 02 · 3 / 19 · 06–10 min

Client and server

A client asks for a service. A server handles requests and returns responses. Our chat server relays messages between clients.

Does the sender's browser have to connect directly to the recipient?

Week 02 · 4 / 19 · 10–14 min

Name, address, port, path

http://localhost:8765/chat/ localhost = name | 8765 = port | /chat/ = path An IP address helps reach a network endpoint.

Which part chooses the resource inside the web service?

Week 02 · 5 / 19 · 14–19 min

DNS finds an address

chat.example → 203.0.113.10 A resolver can answer from a valid cached record. DNS does not carry your chat message.

Would every message need a fresh DNS lookup?

Week 02 · 6 / 19 · 19–23 min

A message becomes network data

Application message → encoded bytes → transport data → IP packets Packets carry addressing information as well as data.

Why is a large message not necessarily sent as one packet?

Week 02 · 7 / 19 · 23–27 min

Routers forward packets

A router chooses a next hop toward a destination. Packets can take different routes. The diagram shows only a few example hops.

Does every packet have to visit the same routers?

Week 02 · 8 / 19 · 27–32 min

Arrival order can differ

Sent: 1, 2, 3 Arrived: 3, 1, 2 Reassembled: 1, 2, 3

What information lets the receiver restore order?

Week 02 · 9 / 19 · 32–37 min

Missing data needs recovery

If a piece is missing, the message is incomplete. Reliable transport can detect gaps and retransmit. Recovery takes time and may ultimately fail.

What should the receiver show while chunk 2 is missing?

Week 02 · 10 / 19 · 37–41 min

Accepted is not read

Accepted: the server has the message. Delivered: the recipient app acknowledges receipt. Read: the recipient reports opening it.

Can the server accept a message while Ben is offline?

Week 02 · 11 / 19 · 41–45 min

Trace a real local chat

Alice's browser POSTs a message. The Python server stores it in memory. Ben's browser polls for messages with GET.

Which action is a request? Which is a response?

Week 02 · 12 / 19 · 45–50 min

Make the recipient go offline

Pause Ben's polling. Send another message from Alice. Resume Ben and watch the delivery receipt.

What can Alice know before Ben reconnects?

Week 02 · 13 / 19 · 50–55 min

Inspect one request

POST /api/messages sends JSON. GET /api/messages?user=Ben retrieves messages. The response tells the browser what happened.

Where does the message wait when Ben's polling is paused?

Week 02 · 14 / 19 · 55–60 min

Be the network

Assign sender, DNS, two routers, server and recipient. Pass three numbered paper chunks. Delay one chunk; restore the message; return a receipt.

Which role handles the name lookup? Which holds the message?

Week 02 · 15 / 19 · 60–64 min

Find the failure

Name lookup fails. The server stops responding. The recipient stops fetching. These failures happen at different stages.

For each failure, name what still might be working.

Week 02 · 16 / 19 · 64–68 min

Rebuild the journey

Name lookup → connection → request → server → recipient → receipt Which steps can be reused? Where do bytes become meaning again?

Explain the route to a partner without looking.

Week 02 · 17 / 19 · 68–71 min

Choose an exploration

Read: MDN, How the web works. Experiment: change the simulated route or lose a chunk. Stretch: inspect requests in the local chat.

Choose one question you want to investigate.

Week 02 · 18 / 19 · 71–73 min

Map a message's journey

Draw sender, DNS, routers, server and recipient. Label one request and one response. Show a failure and explain what the sender knows.

Stretch: add a visible timestamp to the starter chat.

Week 02 · 19 / 19 · 73–75 min

Before you go

1. Does DNS forward the chat message? 2. Does accepted mean the recipient read it? 3. What allows out-of-order data to be reconstructed?

Write one sentence for each, then one question for next week.