1 46 package org.mr.core.net.messages; 47 48 import java.nio.ByteBuffer ; 49 50 62 public class NetworkMessageKeepalive extends NetworkMessage { 63 private int interval; 64 private short connectionTTL; 65 66 public NetworkMessageKeepalive(ByteBuffer buf) { 67 super(buf); 68 this.interval = buf.getInt(); 69 this.connectionTTL = buf.getShort(); 70 } 72 public NetworkMessageKeepalive(int interval, short connectionTTL) { 73 super(NetworkMessage.NET_KEEPALIVE, (short) 6); 74 this.interval = interval; 75 this.connectionTTL = connectionTTL; 76 } 77 78 public int getInterval() { 79 return this.interval; 80 } 81 82 public short getConnectionTTL() { 83 return this.connectionTTL; 84 } 85 86 public void write(ByteBuffer buf) { 87 super.write(buf); 88 buf.putInt(this.interval); 89 buf.putShort(this.connectionTTL); 90 } 91 } | Popular Tags |