If you want to access a service/server running on the host machine you need to use specially designated IP addresses, such as 10.0.2.2.
Note: The following table is taken from Network address space
Network Address | Description |
---|---|
10.0.2.1 | Router/gateway address |
10.0.2.2 | Alias to your host loopback (i.e. 127.0.0.1 on the host machine) |
10.0.2.3 | First DNS server |
10.0.2.4/10.0.2.5/10.0.2.6 | Optional, second, third and fourth DNS server (if any) |
10.0.2.15 | The emulated device network/ethernet interface |
127.0.0.1 | The emulated device loopback interface |