0
嗨,我新來android.From android我可以發送數據到另一個端口。但我無法接收數據使用udp在android.How在android模擬器中使用udp接收數據? 任何人都可以幫助我在android中接收udp數據?如何在android中接收udp數據?
代碼是在這裏
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);
}
客戶等待接收很長一段時間==> clientsocket.receive(recv_packet);
如何在android中接收udp數據?
REDIR這並沒有收到UDP data.How重定向? – Sumi 2010-06-28 17:00:48