On 1/24/21 7:52 PM, Tim via users wrote:
Tim:
It doesn't. The web browser waits for something to answer it. Go on, try to get your web browser to connect to a non-existent server, it doesn't immediately stop looking. If you load up a page that might try waiting for a dozen different things before it will proceed and let you read something, it's a pain.
Samuel Sieb:
That's why you don't use a non-existent server. localhost exists, so you get an immediate rejection.
You can only get an immediate *rejection* if there's something there to reject it. If you don't have a webserver listening on the HTTP and HTTPS ports, and don't have a firewall rejecting connections, then the browser is going to wait for a connection, that's how it works. A rejection is very different from a no response (yet).
That's not correct. If there's a computer at the IP address and nothing is listening on the port and the firewall is not configured to drop packets, then you will get an immediate reply saying that no one's home. If there's no computer at the IP address and it's not on your local subnet, then TCP will keep trying until it times out which will be quite a while. If there's a computer at the IP address and the firewall is configured to drop packets, same thing.
localhost is the first case. There's a computer at the IP address, nothing listening (if you're not running a web server on your computer), and no firewall. So you get an immediate reply that you can't connect, no delays at all.