Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disconnect from localhost?

Is it possible to disconnect from localhost?

I'm writing a Node.js WebSocket server, and I want to test locally what would happen if the connection closes erroneously.

If I were testing remotely, I'd just Turn Wi-Fi Off, but that doesn't disconnect my connection to localhost.

Thoughts?

like image 208
ma11hew28 Avatar asked Aug 28 '12 15:08

ma11hew28


2 Answers

localhost is just an alias in your hosts file. If you remove that alias then you'll be effectively "disconnecting" from localhost.

like image 111
joewyrembelski Avatar answered Sep 21 '22 08:09

joewyrembelski


I don't know of any way you would do what your asking except perhaps to block the ports or the program you are running on your localhost via its firewall.

like image 39
David Hirst Avatar answered Sep 22 '22 08:09

David Hirst