Code example for DatagramPacket

Methods: setAddress

0
	 * @param username 
	 * @throws IOException 
	 */ 
	public boolean send(String username){
		if(UserUtil.isOnline(username)){
			packet.setAddress(UserUtil.getAddress(username));
			//packet.setPort(UserUtil.getUdpPort(username)); 
			try { 
				socket.send(packet);
			} catch (IOException e) {
				e.printStackTrace();
				return false; 
			} 
			return true; 
		}else{ 
			return false; 
		} 
	} 
 
}