class BBS::Zmodem::Stream
The data of one file going out: subpackets streamed from a position, waiting for a ZACK when the receiver’s window is full, and sent again from where a ZRPOS asks.
Public Class Methods
Source
# File lib/bbs/zmodem/stream.rb, line 12 def initialize(input, output, window) @in = input @out = output @window = window end
Public Instance Methods
Source
# File lib/bbs/zmodem/stream.rb, line 21 def send_file(data, pos) @budget = BUDGET_FACTOR * [data.bytesize, SUBPACKET].max RESTARTS.times do pos = send_data(data, pos) || end_of_file(data, pos) return if pos == :done end raise Cancelled end
Sends data from pos and its end, again from where the receiver asks, at most RESTARTS times and BUDGET_FACTOR times its size. Raises Cancelled past those, as the Sender’s errors otherwise.