Code example for DatagramPacket

Methods: setData

0
		 
		String sendStr = String.format("active,active");
		Log.i("handler", "activeUDP active,active");
		byte[] sendBuf2 = sendStr.getBytes();
		try { 
			sendpacket.setData(sendBuf2);
			client.send(sendpacket);
		} catch (Exception e) {
 
		} 
	} 
	 
	public void connUDP(DatagramSocket client,DatagramPacket sendpacket) {
		Log.i("handler", "connUDP 1000");
		 
		 
		try { 
			client.send(sendpacket);
		} catch (IOException e) {
			// TODO Auto-generated catch block 
			e.printStackTrace();