TidFTP: OnWork -> How to identify the TIdFTP-Object in Event? (its NOT Sender)

Giganews Newsgroups
Subject: TidFTP: OnWork -> How to identify the TIdFTP-Object in Event? (its NOT Sender)
Posted by:  Niki Bugarcici (Neik…@web.de)
Date: Wed, 8 Oct 2003

Hi,

I hope ANYONE can point me to a direction with this problem. Thx in advance
for any help...

I am using Threads (in a Downloadmanager) where each Thread has its own
TIdFTP-Object.
So you can download several FTP-Files at the same time.
All TIdFTP-Objects have the same "OnWork"-Event where I would update the
user about the progress.

But :
The "OnWork"-Event will return a TIdTCPClient-Object and NOT a TIdFTP-Object
as "Sender".
I need the TIdFTP-Object or a way to come from TIdTCPClient to the correct
TIdFTP...
(or any other way to identify the download correctly, even if more than 1
download is running from some host)
I tried (Sender as TIdFTP) - which crashes of course :(

I tried to find the correct Object by traversing all TidFTP-Objects and
comparing values with the "Sender"-Object.
(all times only ONE thread is running with one TIdFTP):
- Socket.Binding.Handle (this is different TIdTcpClient<->TidFTP even if
only ONE Thread running? eg. 552+556 is result... why?)
- Host (not usefull because you could download more than one file from a
server)
- tag (NOT the same on both objects ; the TAG of TIdTCPClient is always 0)

So - I am running out of ideas now :(
Anyone any idea how to solve that?

--

Niki Bugarcici

Replies