I am stuck on this from last many hours and did a lot of research.
I used multiple servers for the same code (AWS and DigitalOcean Linux).
I am running a Golang Web Server on port 8090.
err := http.ListenAndServe("127.0.0.1:8090", nil)
ping: unknown host
The classic ping does not work for testing TCP ports, just hosts (see http://serverfault.com/questions/309357/ping-a-specific-port). I've seen many frameworks provide a "ping" option to test if the server is alive, may be this is the source of the mistake.
I like to use netcat:
$ nc localhost 8090 -vvv nc: connectx to localhost port 8090 (tcp) failed: Connection refused $ nc localhost 8888 -vvv found 0 associations found 1 connections: 1: flags=82<CONNECTED,PREFERRED> outif lo0 src ::1 port 64550 dst ::1 port 8888 rank info not available TCP aux info available Connection to localhost port 8888 [tcp/ddi-tcp-1] succeeded!
You may have to install it with
sudo yum install netcat or
sudo apt-get install netcat (respectively for RPM and DEB based distros).