Skip to the page

Computer networks · Scenario

A friend can't open your project from their laptop

The interviewer asks

Your project runs on your laptop and opens fine at localhost port 3000. Your friend on the same hostel Wi-Fi types your laptop's IP address with port 3000, and it doesn't open. What could be wrong, and how do you check?

Then

Follow-ups the interviewer asks next

  1. What are localhost and 127.0.0.1?
  2. How do you find your laptop's IP address on the Wi-Fi?
  3. Your server says it's listening on 127.0.0.1 port 3000. Why does that matter?
  4. Could the Windows firewall block it? How would you know?
  5. After those fixes, your friend's ping to your laptop still fails. What else could stop it on a shared Wi-Fi?
  6. Your friend is at home in another city. Can they open a 192.168 address? Why not, and what would you do instead?

The answer

What a strong answer covers

  • localhost (127.0.0.1) is the loopback address: it always means "this same machine". On your friend's laptop, localhost is their own laptop.
  • Find the Wi-Fi address with ipconfig on Windows or ip addr / ifconfig on Linux and Mac, for example 192.168.1.23.
  • A server listening on 127.0.0.1 accepts connections only from the same machine. Listen on 0.0.0.0 (all network interfaces) instead, for example app.listen(3000, "0.0.0.0") or the dev server's --host option.
  • Firewall: Windows may treat the hostel Wi-Fi as a Public network and allow the app only on Private ones. Allow the port for this network, rather than turning the firewall off.
  • Many hostel and college Wi-Fi networks stop devices from talking to each other (client or AP isolation). Testing on a phone hotspot shows it quickly.
  • From another city: 192.168 addresses are private and sit behind NAT, so the internet can't reach them. Deploy to a free hosting service or a cloud server, or use a tunnel service for a short demo, knowing it exposes your laptop.
  • Check in order: what address the server listens on (netstat) → can the friend ping you → firewall → Wi-Fi isolation.

The red pen

Common traps

Avoid:sending the friend "localhost:3000"; planning port forwarding on a hostel router you don't control; switching the firewall off and leaving it off.

Practise this out loud

Say your answer out loud to an AI interviewer that follows up, and get a score for it.

Practise by voice

Practise questions like this out loud

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview