title: Android never receives UDP packet
body: <p>The below code results in a timeout. </p>
  
  <p>It works fine on non-Android Java.  What's the matter?</p>
  
  <pre><code> //@Override
  public static void run()
  {
      //System.out.println ( "Local Machine IP : "+addrStr.toString (  )  ) ;
      HelloWorldActivity.tv.setText("Trace 1");
  
      try
      {
          // Retrieve the ServerName
          InetAddress serverAddr; //= InetAddress.getByName(Server.SERVERIP);
          InetAddress ias[] = InetAddress.getAllByName(Server.SERVERNAME);
          serverAddr  = ias[0];
  
          Log.d("UDP", "C: Connecting...");
          /* Create new UDP-Socket */
          DatagramSocket socket = new DatagramSocket();
  
          /* Prepare some data to be sent. */
          String strQuery="ÿÿÿÿgetservers"+" "+Server.iProtocol+" "+"'all'";
          Log.d("UDP", strQuery);
          //byte[] buf = ("ÿÿÿÿgetservers 68 'all'").getBytes();
          byte[] buf = strQuery.getBytes();
  
          /* Create UDP-packet with
           * data &amp; destination(url+port) */
          DatagramPacket packet = new DatagramPacket(buf, buf.length,
                                                     serverAddr, Server.SERVERPORT);
  
          Log.d("UDP", "C: Sending: '" + new String(buf) + "'");
  
          /* Send out the packet */
          socket.setSoTimeout(5000);
          socket.send(packet);
          Log.d("UDP", "C: Sent.");
          Log.d("UDP", "C: Done.");
  
          // http://code.google.com/p/android/issues/detail?id=2917
  
          byte[] buffer= new byte[1024*100];
          DatagramPacket receivePacket
            = new DatagramPacket(buffer,
                                 buffer.length); //, serverAddr, Server.SERVERPORT);
          socket.receive(receivePacket);
          HelloWorldActivity.tv.setText("TTT");
  
          String x = new String(receivePacket.getData());
          Log.d("UDP", "C: Received: '" + x  + "'");
          HelloWorldActivity.tv.setText(x);
  
     } catch (Exception e) {
         HelloWorldActivity.tv.setText(e.getMessage());
         Log.e("UDP", "C: Error", e);
     }
  }
  
  
  public class Server
  {
      /*
      //public static java.lang.string SERVERIP;
      public static String SERVERNAME = "monster.idsoftware.com";
      public static String SERVERIP = "192.246.40.56";
      public static int SERVERPORT = 27950;
      public static int PROTOCOL = 68;
        */
  
      //public static String SERVERNAME="monster.idsoftware.com";
      public static String SERVERNAME="dpmaster.deathmask.net";
  
      public static String SERVERIP="192.246.40.56";
      public static int SERVERPORT=27950;
      //public static int iProtocol= 68; // Quake3
      public static int iProtocol=71; // OpenArena
  
  }
  </code></pre>
  
  <p>Android manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;use-permission id="android.permission.READ_CONTACTS" /&gt;
  
      &lt;use-permission android:name="android.permission.WRITE_SETTINGS" /&gt;
      &lt;uses-permission android:name="android.permission.READ_CONTACTS" /&gt;
      &lt;uses-permission android:name="android.permission.CALL_PHONE" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_GPS" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_LOCATION" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_ASSISTED_GPS" /&gt;
      &lt;uses-permission android:name="android.permission.ACCESS_CELL_ID" /&gt;
  
      &lt;uses-permission android:name="android.permission.RECEIVE_SMS" /&gt;
      &lt;uses-permission android:name="android.permission.VIBRATE" /&gt;
      &lt;uses-permission android:name="android.permission.WAKE_LOCK" /&gt;
  
  &lt;application
          android:icon="@drawable/icon"
          android:label="AAA New Application"
          &gt;
      &lt;activity android:name="HelloWorldActivity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN"/&gt;
              &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  </code></pre>
  
  <p></p>