package com.ard.tianyu.netty.command;
|
|
import io.netty.buffer.ByteBuf;
|
|
|
public class HeartbeatCommand extends BaseCommand {
|
|
private final long timestamp;
|
|
public HeartbeatCommand(long timestamp) {
|
setDataHeader((short)0x7479);
|
setDataLength((short)0x09);
|
setCmdCode((byte)0x02);
|
this.timestamp = timestamp;
|
}
|
public void encode(ByteBuf out) {
|
out.writeShort(getDataHeader());
|
out.writeShort(getDataLength());
|
out.writeByte(getCmdCode());
|
out.writeLong(timestamp); // 写入时间戳
|
}
|
}
|