0

I am creating a Android client which successfully uploads a file to my ftp server. I am using ftp4j library and want to send my custom command like this. e.g

mycustomcommand is a kind of tcp command..

FTPClient client = new FTPClient();

    try {

        client.connect(FTP_HOST, 21);
        client.login(FTP_USER, FTP_PASS);
        client.setType(FTPClient.TYPE_BINARY);

        client.changeDirectory("/Test/Uploads/");

        client.upload(fileName, new MyTransferListener());

        /**
         * Need help in this
         */
        FTPReply reply = client.sendCustomCommand("mycustomcommand");
        Log.e(TAG,"reply="+reply.toString() );

    }

Is it possible to do so using ftp or may be I need to use some another method like sockets..?

I just want to perform the action on server side based on mycustomcommand like upload or delete or rename..

Ravi Yadav
  • 2,296
  • 3
  • 25
  • 32
  • This can be done using FTP. But that means you will have to implement this command in your FTP server. Did you write the FTP server code yourself as wel? – Fortega Mar 08 '16 at 13:26
  • what is this 'mycustomcommand'? Is it something your FTP server natively understands? – SergeyA Mar 08 '16 at 14:30
  • @Fortega Means is it possible that I can create a custom script on ftp server which understand my custom command to perform any operation? – Ravi Yadav Mar 09 '16 at 04:15
  • @Fortega can you be more clear about how I can write FTP server code and publish to FTP server using FileZila? – Ravi Yadav Mar 09 '16 at 04:38
  • @SergeyA mycustomcommand is a string like "3212ZZ5y.mp3" ..based on 32 code the file should be uploaded on ftp ...In short I need to upload y.mp3 file by sending this command from Android client. – Ravi Yadav Mar 09 '16 at 05:07
  • @user3138859 It depends on which ftp server you are using. Most of them have some kind of 'plugin' system to create your own commands – Fortega Mar 09 '16 at 08:27

0 Answers0