TidFTPSever turn of server safe?

TidFTPSever turn of server safe?

Post by Franki » Fri, 02 Mar 2007 11:08:21


Hi!

How can i detect if there are any active users on the server...like if
they are downloading something?

I want to turn of my server but how do i know that there aren anyone
downloading or something?

Can i see if any Tstreams are active...or maybe count the
usersLogins-disconnects=users left on server?

How can i be sure that when turning of the server i will not abort
somone downloading something?

Thanx in advance
Frankie
 
 
 

TidFTPSever turn of server safe?

Post by Team » Fri, 02 Mar 2007 13:18:10


The same way you do with any other Indy TCP-based server - check the
server's Threads (Indy 9) or Contexts (Indy 10) list.


TIdFTPServer does not keep track of that information. You have to
keep track of that in your own code.


You have to track that yourself.


The server does keep track of that much for you.


Gambit

 
 
 

TidFTPSever turn of server safe?

Post by Franki » Fri, 02 Mar 2007 22:37:57

Remy Lebeau (TeamB) skrev:



And where do i find this list?


You mean i have to rewrite the Tstream class?


They do? Is there a value or something i can read from? Or is is the
Contexts List you where talking about earlier in this post?


/Thanx in advance
Frankie
 
 
 

TidFTPSever turn of server safe?

Post by Team » Sat, 03 Mar 2007 03:17:41


It is a propety of TIdTCPServer. Please read the documentation.


That is part of it, as that is the only way to detect when a transfer
is finished. You will have to set up your own list of download
information, and then use the OnStoreFile and OnRetreiveFile events,
and the TStream destructor, to keep that list up-to-date.


Again, please read the documentation. In the Threads (Indy 9) or
Contexts (Indy 10) list, the server holds TIdFTPServerThread (Indy 9)
or TIdFTPServerContext (Indy 10) object instances, one for each
client. That will tell you how many clients are connected, and they
have a UserName property available, so you will know who is logged in.


Gambit
 
 
 

TidFTPSever turn of server safe?

Post by Franki » Sun, 04 Mar 2007 13:00:36


Remy Lebeau (TeamB) skrev:


>
>> And where do i find this list?
>
> It is a propety of TIdTCPServer. Please read the documentation.
>
>>> You have to track that yourself.
>> You mean i have to rewrite the Tstream class?
>
> That is part of it, as that is the only way to detect when a transfer
> is finished. You will have to set up your own list of download
> information, and then use the OnStoreFile and OnRetreiveFile events,
> and the TStream destructor, to keep that list up-to-date.
>
>>>> or maybe count the usersLogins-disconnects=users left on server?
>>> The server does keep track of that much for you.
>> They do? Is there a value or something i can read from?
>
> Again, please read the documentation. In the Threads (Indy 9) or
> Contexts (Indy 10) list, the server holds TIdFTPServerThread (Indy 9)
> or TIdFTPServerContext (Indy 10) object instances, one for each
> client. That will tell you how many clients are connected, and they
> have a UserName property available, so you will know who is logged in.

Yeah, i read the docs...and it not easy when it says "Topic will be
explalined later" or something like that.

It isn easy to learn Indy when the demos absolutely suck 2....they are
more then 3 years old.

Why don you just tell me what property i should look for? I found:
FtpServer.Context but there are no User information there...all i got is
a locklist property/method

/Hope you understand my frusrtation...if you don i am willing to
explalin it more
Frankie
>
>
> Gambit
>
>




Remy Lebeau (TeamB) skrev:
 
 
 

TidFTPSever turn of server safe?

Post by Team » Sun, 04 Mar 2007 17:58:18


I already have. Please re-read my earlier replies again more
carefully.


Then you did not pay attention to what I actually told you. I will
say it again:

TIdFTPServerContext ...
clients

For example:

uses
IdObjs;

var
List: TIdList;
I: Integer;
Ctx: TIdFTPServerContext;
begin
List := IdFTPServer1.Contexts.LockList;
try
for I := 0 to List.Count-1 do
begin
Ctx := TIdFTPServerContext(List[I]);
ShowMessage(Ctx.Username);
end;
finally
IdFTPServer1.Contexts.UnlockList;
end;
end;


Gambit