How is "Connection timed out" different from "Connection refused"?
Quick Answer
Timed out means the request got no response at all — usually a firewall dropping packets, an ACL, or a network/routing problem. Refused means the host responded with a rejection (nothing listening). Timeouts point at the network path; refused points at the service.
Detailed Answer
For a timeout, packets are silently dropped: check with ping and traceroute to see where the path dies, telnet/nc to the port, and review security groups/ACLs/firewalls between client and server. For refused, the host is reachable but the port is closed. The distinction narrows the fault domain quickly: network/firewall vs service.
Code Example
ping <ip> traceroute <ip> nc -zv <ip> <port>
Interview Tip
This exact comparison is a favourite — timeout = dropped (network/firewall), refused = actively rejected (service/port).