Re: IdFTPCommandHandler response

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

"Marc Pelletier" <marc@goldak.stopspam.ca> wrote in message
news:Xns9628A8E291953mpgex…@206.123.68.233...

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

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

Gambit

Replies

In response to

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