Code example for DatagramPacket

Methods: setData

0
	 */ 
	private void _sendObject(final JSONObject o) {
		Log.d(LOG_TAG, o.toString());
 
		// Send the data onto the network 
		_packet.setData(o.toString().getBytes());
		try { 
			_socket.send(_packet);
		} catch (SocketException e) {
			// Local network not ready, no route to host, ... 
			; 
		} catch (IOException e) {
			// TODO Auto-generated catch block : send a notification ? 
			e.printStackTrace();
		} 
	} 
 
	/** 
	 * Build a tilt tracker JSON object 
	 *  
	 * This method updates the _sensorJsonObject object