I wrote an app on my phone with Android. I'm debugging it on phone. I try to connect to a server written in C#, but every time I try to connect, I have exception:
EHOSTUNREACH (No route to host)
I add to 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);
}