Code example for DatagramPacket

Methods: getAddress, getData, getLength, getPort

0
					hand.post(new Runnable() {
						  
						@Override 
						public void run() { 
							// TODO Auto-generated method stub 
							String received = new String(packet.getData(), 0, packet.getLength());
							tv.append("\nRicevuto: \""+received+"\" da: "+packet.getAddress().toString()+":"+packet.getPort());
						} 
					}); 
					} 
				} catch (IOException e) {
					// TODO Auto-generated catch block 
					e.printStackTrace();
				} 
				 
			} 
		}; 
		new Thread(runnable).start();
	} 
 
}