Failed Connect Local Host (Desktop)


Hi using retrofit api call method but am using local ip address still am not get proper response. if i tested in postman i got correct json response but in android studio am facing this connection issue.

Error…> HTTP FAILED: failed to connect to / (port 5000) from / (port 58978) after 60000ms: isConnected failed: ETIMEDOUT (Connection timed out)


I had this problem before and I remember that if you have your server running in the same network as the app you need to use{PORT} or the laptop network IP (in case you run it on a real device).

So your endpoint in your case should be :

//For real device
private const val BASE_URL  ""
//For emulator
private const val BASE_URL  ""

Check please that is not problem with your Firewall sometimes you have to allow access (restarting PC would be enought to know if it’s the problem)

Answered By – Skizo-ozᴉʞS

Leave a Comment