me.edwards.des.net.packet
Class PacketPing

java.lang.Object
  extended by me.edwards.des.net.packet.Packet
      extended by me.edwards.des.net.packet.PacketPing

public class PacketPing
extends Packet

Ping Packet

This packet is sent to request a response from its destination Node.

Created on: Oct 17, 2015 at 9:12:01 AM

Author:
Matthew Edwards

Nested Class Summary
 
Nested classes/interfaces inherited from class me.edwards.des.net.packet.Packet
Packet.PacketTypes
 
Field Summary
private  long ping
           
 
Constructor Summary
PacketPing(byte[] binary)
          Creates new PacketPing from binary data
PacketPing(long ping)
          Creates new PacketPing
 
Method Summary
 byte[] getBinary()
          Returns the binary payload of this Packet as a byte array.
 long getPing()
          Returns the Nonce for checking ping.
 
Methods inherited from class me.edwards.des.net.packet.Packet
getID, lookup, toHex, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ping

private long ping
Constructor Detail

PacketPing

public PacketPing(long ping)
Creates new PacketPing

Parameters:
ping - Nonce for checking ping

PacketPing

public PacketPing(byte[] binary)
Creates new PacketPing from binary data

Parameters:
binary - Packet binary data
Method Detail

getPing

public long getPing()
Returns the Nonce for checking ping. Should be incremented by one when returned using a Pong Packet.

Returns:
Nonce for checking ping

getBinary

public byte[] getBinary()
Description copied from class: Packet
Returns the binary payload of this Packet as a byte array.

Specified by:
getBinary in class Packet
Returns:
Binary payload as a byte array