background image

 
byte[] buf = hello.getBytes();
  

//将数据转换成 Byte 类型

 
  op = 

new

 DatagramPacket(buf, buf.length, target, 12345);

  

//将 BUF 缓冲区中的数据打包

 
  ds.send(op);
  

//发送数据

 
  ds.close();
  

//关闭连接