title: android socket code
body: <p>Why can't a socket be open with this code:</p>
  
  <pre><code>                try {
                      Connect=(Button)findViewById(R.id.connect);
                      InetSocketAddress address = new InetSocketAddress("192.168.1.2",54628);
                      DatagramPacket request = new DatagramPacket(cmd.getBytes(), cmd.length(), address);
                      DatagramSocket socket = new DatagramSocket();
                      socket.send(request);
                  } catch (SocketException e) {
                      System.out.print("SSSS");
                  }
  </code></pre>
  
  <p>but it does work when I do:</p>
  
  <pre><code>    clientSocket= new Socket("192.168.1.2",54635); 
      Text.append( "\n created a socket");
  </code></pre>
  
  <hr>
  
  <p>Error logs:</p>
  
  <pre><code>05-24 23:04:58.497: ERROR/AudioPolicyManagerBase(95): unknown stream type
  05-24 23:05:10.787: ERROR/AudioPolicyManagerBase(95): unknown stream type
  05-24 23:05:10.787: ERROR/AudioPolicyManagerBase(95): unknown stream type
  05-24 23:05:10.787: ERROR/AudioPolicyManagerBase(95): unknown stream type
  05-24 23:05:10.787: ERROR/AudioPolicyManagerBase(95): unknown stream type
  </code></pre>