怎么解决这个一次循环?
把Datagramsocket放到循环外试一下
Datagrampacket packet=new Datagrampacket(new byte[1024],1024); while(true){ datasocket.receive(packet); byte[]arr=packet.getData(); int len=packet.length(); syso(arr,0,len); }
在线程里面吧socket.close()删除