No route to accommodate
I wrote apss for android phone. I am debugging it over the phone. I am trying to communicate with serwer in C # but every time I try to connect I have an exception
EHOSTUNREACH (No route to host)
I add to the manifest
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
My code to connect:
try {
InetAddress serverAddr = InetAddress.getByName(IP);
int PortI = Integer.parseInt(Port);
socket = new Socket(serverAddr, PortI);
}
+3
source to share
1 answer
Try it!
-
Check that your device is connected to the internet making the request to the server and on the same network when testing on the local network.
-
Make sure you have disabled the server firewall if you are connected on a local network.
-
Check the url where you are submitting the request.
+3
source to share