I have a server running on my local computer (Windows 7) that listens for an incoming tcp socket connection. On the same machine, I run the Android emulator through IntelliJ.
The connection is being established. By doing:
Socket socket = new Socket(); InetSocketAddress address = new InetSocketAddress("10.0.2.2", 8082); socket.connect(address);
But when trying the host name:
Socket socket = new Socket(); InetSocketAddress address = new InetSocketAddress("comp2", 8082); socket.connect(address);
I get:
java.net.UnknownHostException: Host is unresolved: comp2:8082
When I use the Windows command prompt for ping (by host name), my computer and other computers on the same network receive responses.
Any idea on how to make it work?
source share