Question

I am getting a really weird error. Trying to solve it nearly for 5 hours, but I'm hopeless now.

I'm developing an android application that connects to localserver, and receive some data. I am using my own phone instead of emulator. Everything was normal until today. I mean, I was getting data without any problem.

However, I am getting the following error message

IOException: org.apache.http.conn.HttpHostConnectException: Connection to http://192.168.2.201 refused

My phone and localserver are on same wireless network. I changed IP to 10.0.2.2 to see if everything is okay on emulator, and actually there is no problem. I can see the results in emulator.

I changed the IP address of my computer (localserver), and tried again, but I'm still getting the same error.

Since I can get the results on emulator, I'm sure the connection code, android permissions, etc are correct. Probably, my phone is the one that creates problem.

Could you give some suggestions about connection refuse problem?

PS: I've already tried restarting the devices (server, phone, pc, modem) a couple of times.

Was it helpful?

Solution

Although I disabled before, somehow windows firewall was opened, and it was blocking phone's connection requests.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top