package org.kne.cloud.network.klalb;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;

public class PONGPacket extends KLALBPacket {
	
	public long getTimepingsnd() {
		return timepingsnd;
	}

	public long getTimepingrcv() {
		return timepingrcv;
	}

	public long getTimepongsnd() {
		return timepongsnd;
	}
	private long timepingsnd,timepingrcv,timepongsnd;

	@Override
	protected void writeToStream(DataOutput dto) throws IOException {
		super.writeToStream(dto);
		dto.writeLong(timepingsnd);
		dto.writeLong(timepingrcv);
		dto.writeLong(timepongsnd);
	}

	@Override
	protected void readFromStream(DataInput din) throws IOException {
		super.readFromStream(din);
		timepingsnd=din.readLong();
		timepingrcv=din.readLong();
		timepongsnd=din.readLong();
	}

	@Override
	public long getLength() {
		return super.getLength()+24;
	}
	public PONGPacket() {
		super(PONG);
	}
	
	public PONGPacket( long timepingsnd, long timepingrcv, long timepongsnd) {
		super(PONG);
		this.timepingsnd = timepingsnd;
		this.timepingrcv = timepingrcv;
		this.timepongsnd = timepongsnd;
	}

	@Override
	public String toString() {
		return "PONG";
	}
}
