class QuartzTorrent::UdpTrackerRequest

Superclass for UDP tracker requests.

Attributes

action[R]

Get the action as an integer. Should be one of the UdpTrackerMessage::Action* constants

connectionId[R]

Get the connectionId as an integer

transactionId[R]

Get the transactionId as an integer.

Public Class Methods

new() click to toggle source
# File lib/quartz_torrent/udptrackermsg.rb, line 55
def initialize
  @connectionId = 0x41727101980
  @action = UdpTrackerMessage::ActionConnect
  # Get a number that is a valid 32-bit signed integer.
  @transactionId = rand(0x10000000)-8000000
end

Public Instance Methods

action=(v) click to toggle source

Set the action. Value should be one of the UdpTrackerMessage::Action* constants

# File lib/quartz_torrent/udptrackermsg.rb, line 75
def action=(v)
  raise "The 'action' field must be an integer" if ! v.is_a?(Integer)
  @action = v
end
connectionId=(v) click to toggle source

Set the connectionId. Value must be an integer

# File lib/quartz_torrent/udptrackermsg.rb, line 70
def connectionId=(v)
  raise "The 'connectionId' field must be an integer" if ! v.is_a?(Integer)
  @connectionId = v
end
transactionId=(v) click to toggle source

Set the transactionId. Value must be an integer. If not set a random number is used as per the specification.

# File lib/quartz_torrent/udptrackermsg.rb, line 80
def transactionId=(v)
  raise "The 'transactionId' field must be an integer" if ! v.is_a?(Integer)
  @transactionId = v
end