The client failed to establish a connection to the local address
The error encountered was:
dial tcp [::1]:3000: connectex: No connection could be made because the target machine actively refused it.
How can I solve it?
- Change your localhost:3000 address to local IP address for example 192.168.1.15:3000 etc.
- Your server and client must be in same network
On an emulator the localhost is accessible using the IP 10.0.2.2 .
localhost:3000 will be
10.0.2.2:3000 in your emulator.
First of all you must be on the same network to be able to connect.
- Get the PC ip using
- Connect to the PC localhost using it’s ip. i.g
(your firewall must be OK with this)
If you are trying to connect using code, same things are needed for this