Task
Connect to a server, change directory, list its contents and download a file as binary using the FTP protocol. Use passive mode if available.




$ include "seed7_05.s7i";
  include "ftp.s7i";
 
const proc: main is func
  local
    var ftpFileSys: ftp is fileSys.value;
    var string: line is "";
  begin
    ftp := openFtp("kernel.org");
    setActiveMode(ftp, FALSE);  # Passive is the default.
    chdir(ftp, "/pub/linux/kernel");
    for line range listDir(ftp, ".") do
      writeln(line);
    end for;
    setAsciiTransfer(ftp, FALSE);
    writeln(getFile(ftp, "README"));
    close(ftp);
  end func;