Aleksey,

Create multiple FTP components, assign them the same event handlers.

for I := 1 to 10 do
begin
  Ftp := TFtpClient.Create(nil);
  [..]
  Ftp.OnRequestDone := FtpRequestDone;
  List.Add(Ftp);
end;

Cast the Sender that is available in any event handler like: 

procedure TForm1.FtpRequestDone(Sender: TObject;
  RqType: TFtpRequest; ErrCode: Word);
begin
  case RqType of 
   ftpOpenAsync : TFtpClient(Sender).UserAsync;
  ..    
end;

---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html



---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html


Aleksey Potjomkin wrote:
> Hello !
> 
>    > just download the ics v5 and then have a look in de ics/internet
> directory
> 
> OK, I did. But i'm still can't understand main point of it. How to
> handle concurrent connections ??? As I understood, main feature of it
> is event "OnRequestDone" and there I can make a switch:
> "       case RqType of
>         ftpOpenAsync:   //..
>         ftpUserAsync:    //..
>         ftpPassAsync:   //..
>         ftpCwdAsync:     //..
>         ftpTypeSetAsync: //..
>         ftpGetAsync:     //..
>         ftpQuitAsync:    //..
> "
> Something like that. But anyways, it's only about 1 connection at the
> same time. For example i have on my form "TFTPCli" component named
> "FTP". So how I can open 2 connections at the same time ??? It will
> be the same as with synchronous sockets. First i need to work out 1st
> connection and only then work with other one.
>   For example:
> "
>   FTP->HostName = "myhost1.com";
>   FTP->User = "user1";
>   FTP->Pass = "pass1";
> 
>   FTP->OpenAsync;
> 
>   // now OnRequestDone event:
>   {
>   switch(RqType):
>     case ftpOpenAsync: FTP->UserAsync;
>     case ftpUserAync: FTP->PassAsync;
>     case ftpPassAsync: // ...
>   }
> "
>   So only after this connection with worked out i can take another
> one, right ? Because if i type:
> "
>   FTP->HostName = "myhost1.com";
>   FTP->User = "user1";
>   FTP->Pass = "pass1";
> 
>   FTP->OpenAsync;
> 
>   FTP->HostName = "myhost2.com";
>   FTP->User = "user2";
>   FTP->Pass = "pass2";
> 
>   FTP->OpenAsync;
> "
>   User & pass are changed now (if first one isn't done still), so
> that will be all wrong. That means I can't work with 2 connections at
> once. That's why i used threads. So what you can advice me to do with
> all that ? Or maybe I'm not understanding something ?
> 
> ----
> Aleksey
> 
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's
> FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to