me.edwards.des.net.packet
Class PacketVersion

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

public class PacketVersion
extends Packet

Version Packet

This is used in the handshake protocol for the DES system and contains version, block count, and time.

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  int port
           
private  Version version
           
 
Constructor Summary
PacketVersion(byte[] binary)
          Creates new PacketVersion from binary data
PacketVersion(Version version, int port)
          Creates new PacketVersion
 
Method Summary
 byte[] getBinary()
          Returns the binary payload of this Packet as a byte array.
 int getPort()
          Return the sender Node's port.
 Version getVersion()
          Returns the Version of the sender Node.
 
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

version

private Version version

port

private int port
Constructor Detail

PacketVersion

public PacketVersion(Version version,
                     int port)
Creates new PacketVersion

Parameters:
version - Node DES Version
port - Node port

PacketVersion

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

Parameters:
binary - Packet binary data as byte array
Method Detail

getVersion

public Version getVersion()
Returns the Version of the sender Node.

Returns:
Version of the sender Node

getPort

public int getPort()
Return the sender Node's port. Used to set the correct port of the Connection.

Returns:
Port of the sender Node

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