Re: IdFTPCommandHandler response

Giganews Newsgroups
Subject: Re: IdFTPCommandHandler response
Posted by:  Remy Lebeau (TeamB) (
Date: Tue, 29 Mar 2005

"Marc Pelletier" <> wrote in message

> 1. The TIdFTP.Sendcmd method should return a result, but I
> can't seem to set one in the TIdFTPServer command handler.

Yes, you can.  The is what the TIdCommand.Reply property is specifically

> My command handler code is as follows:

The only thing wrong with that code is that it is not thread-safe.  Indy
servers are multi-threaded. You cannot access the GUI directly from any Indy
event handler that provides access to a TIdPeerThread/TIdContext.  In the
case of command handlers, the Thread/Context is a proprty of the TIdCommand.
To access the GUI, use the TIdSync class.

> I'm not sure where to assign the result.

Yes you are, because you are already doing so.

> The response I am receiving on the other end is 0.

FTP replies need to be exactly 3 digits, no more, no less.  All RFC-based
ASCII protocols, with the exception of POP3 and IMAP, use 3-digit numeric
values for replies.  Indy's parser expects 3 digits.

> 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.

That is also related to you using non-standard reply numbers.



In response to

IdFTPCommandHandler response posted by Marc Pelletier on Tue, 29 Mar 2005