Re: Sendcmd

Giganews Newsgroups
Subject: Re: Sendcmd
Posted by:  Gordon K√§stner (Meta7…@arcor.de)
Date: Mon, 16 Oct 2006

Don Locke schrieb:
> I would like to execute an inno update file on a web site using FTP. I
> think that the only way is to use the Sendcmd function. But I don't find
> any examples of using it in FTP. I have downloaded all of the demos I
> could find with no help.  Could someone help me with this?
> Don

On client side just call SendCmd()

  SendCmd('MYTESTCOMMAND');
  Result := LastCmdResult.Text

On server side add your command handlers under
TIdFTPServer.CommandHandlers in the IDE (Don't forget to set "Command"
propetry! e.g. MYTESTCOMMAND) and the according method to the OnCommand
event...

procedure TfrmMain.IdFTPServerccDiskFreeSpaceCommand(ASender: TIdCommand);
var
  freeAvailable, TotalSpace: Int64;
  totalFree: ULARGE_INTEGER;
begin
  try
    freeAvailable := 0;
    TotalSpace := 0;
    totalFree.LowPart := 0;
    totalFree.HighPart := 0;
    totalFree.QuadPart := 0;

    try
      GetDiskFreeSpaceEx(PChar(TConfigData(ASender.Context.Data).FUNC),
                          freeAvailable, TotalSpace, @totalFree);
    except
    end;
    //Sending free diskspace back to client
    ASender.Reply.SetReply(250, IntToStr(totalFree.QuadPart));

  except
  end;

hth

God bless you

Replies

None

In response to

Sendcmd posted by Don Locke on Sun, 15 Oct 2006