I am writing a code where the android phone is the client trying to connect to the server on my pc USING WIFI. I am opening the sockets as follows:
try {
servsock = new ServerSocket(13299);
System.out.println("Listening :13299");
} catch (IOException e) {
e.printStackTrace();
}
while (true) {
Socket sock = servsock.accept();
and on client side:
Socket sock = new Socket("192.168.0.108", 13299);
Log.i("sending","sending");
However I am receiving on the logcat: “No route to host” I have searched and inserted permission to use internet in the manifest.xml and did a ping from my phone with ip 192.168.0.107 to the pc server with ip 192.168.0.108.
What Am I missing? Why isn’t the tcp socket connection established ? the server is written in netbeans. Does it have to do with the ports?
EDIT: I think the problem is in the IP addresses. I set the address of the server (private address) according to the output of “ipconfig” in cmd window.
I had the same issue, i changed the internet access point and the app worked. My app was using a local IP to access the server.