retrbinary(cmd, blocksize, rest_offset = nil)
public
Puts the connection into binary (image) mode, issues the given command, and
fetches the data returned, passing it to the associated block in chunks of
blocksize characters. Note that cmd is a server command
(such as “RETR myfile”).
Show source
def retrbinary(cmd, blocksize, rest_offset = nil)
synchronize do
with_binary(true) do
begin
conn = transfercmd(cmd, rest_offset)
loop do
data = conn.read(blocksize)
break if data == nil
yield(data)
end
conn.shutdown(Socket::SHUT_WR)
conn.read_timeout = 1
conn.read
ensure
conn.close if conn
end
voidresp
end
end
end