class QuartzTorrent::Request

Request message. Request a block within a piece.

Attributes

blockLength[RW]
blockOffset[RW]
pieceIndex[RW]

Public Class Methods

new() click to toggle source
Calls superclass method QuartzTorrent::PeerWireMessage::new
# File lib/quartz_torrent/peermsg.rb, line 245
def initialize
  super(MessageRequest)
end

Public Instance Methods

payloadLength() click to toggle source
# File lib/quartz_torrent/peermsg.rb, line 253
def payloadLength
  12
end
serializeTo(io) click to toggle source
# File lib/quartz_torrent/peermsg.rb, line 257
def serializeTo(io)
  super(io)
  io.write [@pieceIndex, @blockOffset, @blockLength].pack("NNN")
end
to_s() click to toggle source
Calls superclass method QuartzTorrent::PeerWireMessage#to_s
# File lib/quartz_torrent/peermsg.rb, line 266
def to_s
  s = super
  s + ": piece index=#{@pieceIndex}, block offset=#{@blockOffset}, block length=#{@blockLength}"
end
unserialize(payload) click to toggle source
# File lib/quartz_torrent/peermsg.rb, line 262
def unserialize(payload)
  @pieceIndex, @blockOffset, @blockLength = payload.unpack("NNN")
end