private int connectFTP() {
    // create client

    try {
      ftp = new FileTransferClient();

      ftp.setRemoteHost(REMOTE_FTP_IP);
      ftp.setRemotePort(REMOTE_FTP_PORT);

      ftp.connect();

      if (ftp.isConnected()) {
        Log.d(DroneConsts.DroneLogTag, "FTP Connected");
      }

      if (ftp.exists("version.txt")) {
        Log.d(DroneConsts.DroneLogTag, "version.txt exists => right directory!");
      }
    } catch (Exception e) {
      Log.d(DroneConsts.DroneLogTag, "Error: FTP NOT Connected!");
      e.printStackTrace();
      return -1;
    }
    return 0;
  }
Пример #2
0
 public static void Upload(String src, int team) throws FTPException, IOException {
   FileTransferClient ftp = new FileTransferClient();
   ftp.setRemoteHost("10." + (team / 100) + "." + (team % 100) + ".2");
   ftp.connect();
   // (project)/PPC603gnu/projectname/Debug/projectname.out
   ftp.uploadFile(src, "/ni-rt/system/FRC_UserProgram.out");
   ftp.disconnect();
 }