Code example for DatagramPacket

Methods: setAddress

0
		/* 
		 * There is a single _packet instance to avoid numerous object creation 
		 * in onSensorChanged() 
		 */ 
		byte dummy[] = { 0 };
		_packet = new DatagramPacket(dummy, dummy.length);
 
		// Set the address with anything since _sendObject will be called before 
		// setUri has been called // why 
		try { 
			_packet.setAddress(InetAddress.getLocalHost());
		} catch (UnknownHostException e) {
		} 
	} 
 
	/** 
	 * Send the string representation of a Json Object. 
	 *  
	 * @param[in] o the json object to send 
	 */ 
	private void _sendObject(final JSONObject o) {