Class: TFTP::Protocol::ACK

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/tftp/protocol.rb

Overview

ACK Packet

Instance Method Summary collapse

Instance Method Details

#create(opts = {}) ⇒ Object



61
62
63
64
65
66
67
68
69
# File 'lib/tftp/protocol.rb', line 61

def create(opts = {})
  self.opcode = OP_ACK
  self.block_num = opts.fetch(:block_num, 0)

	# Catch the invalid block nums
  raise TFTP::Error.message(:invalid_block_num) if opts[:block_num].to_i < 0

  self
end