title: Can't connect Android to desktop server
body: <p>I'm developing a game using libGdx and Kryonet and I'm currently working on the server &lt;-> android connection.</p>
  
  <p>First I run the server on a computer, and if I run two instances of the program on the same computer (so the IP will be the local IP: "127.0.0.1"), I don't get any problems, and the connection works fine.</p>
  
  <p>But if instead of running the game on desktop, I run it on the android device, the connection doesn't happen. Both the devices are connected to the same Wi-fi network, so to discover the IP, what I do is type "ipconfig" on the console, and check the line that says: "IPv4 Adress" under "Wireles LAN adapter Wi-Fi" (I think it's this one).</p>
  
  <p>I've added this 3 lines to the android manifest file (are they really needed?):</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  </code></pre>
  
  <p>Here's the important error log:</p>
  
  <p><a href="https://i.stack.imgur.com/ZNLAR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZNLAR.png" alt="enter image description here"></a>
  Do I need to do anything on the device some extra code for the android connection to establish? More permissions perhaps?</p>
  
  <p>Here's the relevant code:
  MPServer:</p>
  
  <pre><code>public class MPServer {
  Server server;
  Array&lt;PlayerInfo&gt; playersInfo;
  int numNewPlayers;
  
  public MPServer() throws IOException {
      numNewPlayers = 0;
      playersInfo = new Array&lt;PlayerInfo&gt;();
      server = new Server();
  
      Network.registerPackets(server);
      addListeners();
      server.bind(Network.PORT);
      server.start();
  }
  
  private void addListeners() {
      server.addListener(new Listener() {
          @Override
          public void connected(Connection connection) {
  
          }
  
          @Override
          public void disconnected(Connection connection) {
  
          }
  
          @Override
          public void received(Connection c, Object object) {
  
          }
      });
  }
  
  public static void main(String[] args) {
      try {
          new MPServer();
          Log.set(Log.LEVEL_DEBUG);
      } catch (IOException e) {
          e.printStackTrace();
      }
  }
  }
  </code></pre>
  
  <p>MPClient:</p>
  
  <pre><code>public class MPClient {
  static final int TIME_OUT = 5000;
  Client client;
  MultiPlayMatch match;
  
  
  public MPClient(String name, int team, MultiPlayMatch match) {
      this.match = match;
      client = new Client();
      client.start();
  
      Network.registerPackets(client);
      addListeners();
  
      try {
          client.connect(15000, Network.WIFI_IP, Network.PORT);
      } catch (IOException e) {
          e.printStackTrace();
          client.stop();
      }
  
      while(true) {
  
      }
  
  }
  
  private void addListeners() {
      client.addListener(new Listener.ThreadedListener(new Listener() {
          @Override
          public void connected(Connection connection) {
  
          }
  
          @Override
          public void disconnected(Connection connection) {
  
          }
  
          @Override
          public void received(Connection connection, Object object) {
  
          }
      }));
  }
  }
  </code></pre>