Re: Event sequense upon client disconnection

Giganews Newsgroups
Subject: Re: Event sequense upon client disconnection
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Wed, 9 Mar 2005

"Khash Sajadi" <kha…@btinternet.com> wrote in message
news:5E4D3C3B8DC2E240kha…@btinternet.com...

> Could someone please tell me the event firing sequence when a
> client is disconnected in the middle of the upload to a TldFTPServer?

The only event triggered is OnDisconnect, and that only triggers when
command connections are disconnected, not data transfer connections.

> I need to perform some special tasks in case the connection is
> disconnected before upload is finished. I know that OnDisconnect
> gets fired but it has a TIdPeerThread as the parameter and I'm after
> an event that gets called before that with a TIdFTPServerThread instead.

The TIdPeerThread *is* the TIdFTPServerThread.  Simply cast it:

    procedure TForm1.IdFTPServer1Disconnect(AThread: TIdPeerThread);
    var
        FTPThread: TIdFTPServerThread;
    begin
        FTPThread := TIdFTPServerThread(AThread);
        // use FTPThread as needed...
    end;

Gambit

Replies

In response to

Event sequense upon client disconnection posted by Khash Sajadi on Wed, 9 Mar 2005