title: how to receive udp data in android?
body: <p>Hi I am new to android.From android i can send data to another port.But i am not able to receive the data using udp in android.How to receive data by using udp in android emulator?
  can anyone help me to receive the udp data in android?</p>
  
  <p>Code is here</p>
  
  <pre><code>DatagramSocket clientsocket=new DatagramSocket(4900);
  byte[] receivedata=new byte[1024];
  while(true)
  {
  DatagramPacket recv_packet=new DatagramPacket(receivedata, receivedata.length);
  textview.setText("UDP S: Receiving...");
  clientsocket.receive(recv_packet);
  String rec_str=new String(recv_packet.getData());           
  textview.setText(" Received String "+rec_str); 
  }
  </code></pre>
  
  <p>client wait to receive for a long time on ==>  clientsocket.receive(recv_packet); </p>
  
  <p>how to receive udp data in android?</p>