A Simple Client-server - Android<>pc
I am testing socket programming on Android however I am having a problem. The client is basically launched through the main activity with a basic function of sending a message to t
Solution 1:
In Android, localhost would point to the phone/emulator itself. It doesn't point to your server. The following line below is pointing to your Android device/emulator and not your server. You need to get the actual IP of the server to get it working from your Android
InetAddresshost= InetAddress.getLocalHost();
Socketsocket=newSocket(host.getHostName(),7777);
It works through Java App, because when you execute it from the context of Java Application, the localhost is pointing to the same server location.
Post a Comment for "A Simple Client-server - Android<>pc"