IdFTPCommandHandler response

Giganews Newsgroups
Subject: IdFTPCommandHandler response
Posted by:  Marc Pelletier (
Date: Tue, 29 Mar 2005


I am building a matching ftp server and client with some custom
functionality. I am sending a command from the client and handling it in
a ftpserver commandhandler.

The command is being received and I am creating a response but I have a
couple of issues.

1. The TIdFTP.Sendcmd method should return a result, but I can't seem to
set one in the TIdFTPServer command handler. My command handler code is
as follows:
procedure TfmSyncMain.IdFTPServer1TIdCommandHandler0Command(
  ASender: TIdCommand);
  ASender.Reply.NumericCode := 1;
  ASender.Reply.Text.Add( 'got ' + ASender.RawLine);

I'm not sure where to assign the result. I've tried
ASender.Thread.ReturnValue, but that isn't right. The response I am
receiving on the other end is 0.

2. If I inspect TIdFTP.LastCmdResult.Text.Text after the sendcmd, I am
seeing the reply I set above but the first 2 characters are missing and
there are 2 unprintable characters on the end.

This is pretty basic stuff I know, but I can't seem to find the relevant
information in the help or examples.


Marc Pelletier
Goldak Airborne Surveys