Board index » delphi » FTPServer Demo

FTPServer Demo


2005-01-26 03:42:20 PM
delphi261
Hello, was there a Demo for TIdFTPServer?
My first questions:
1. Where do i store userinformation after login?
(I can't set a cookie and start a session like
in http ;) )
2. How can i access this in other events? (like
ListDirectory and so on)
You see i know the handling in a HTTP Server, but
there are many questions to use TIdFTPServer. I found
on my search in the internet, that there are many requests
for a TIdFTPServer Demo!
---------------------------------------------
Thomas Wegner
CabrioMeter - The Weather Plugin for Trillian
www.wegner24.de/cabriometer
 
 

Re:FTPServer Demo

Hi,
You should have assigned a TidUserManager for your TidFTPServer, where you
can set user accounts. In this component you will find all info you need and
you can access it from anywhere. Particularly in TidUserManager1.Accounts
you'll find what you need.
Another thing you have to do (if you haven't, first time i didn't :) when
using a TidFTP is to assign event handlers for the onRetrieveFile and
onStoreFile events.
Best regards
--
Guillem Vicens
Dep. informática Green Service SA
XXXX@XXXXX.COM
www.clubgreenoasis.com
"Thomas Wegner" <XXXX@XXXXX.COM>escribi?en el mensaje
Quote
Hello, was there a Demo for TIdFTPServer?

My first questions:

1. Where do i store userinformation after login?
(I can't set a cookie and start a session like
in http ;) )
2. How can i access this in other events? (like
ListDirectory and so on)

You see i know the handling in a HTTP Server, but
there are many questions to use TIdFTPServer. I found
on my search in the internet, that there are many requests
for a TIdFTPServer Demo!
---------------------------------------------
Thomas Wegner
CabrioMeter - The Weather Plugin for Trillian
www.wegner24.de/cabriometer

 

Re:FTPServer Demo

"Thomas Wegner" <XXXX@XXXXX.COM>writes
Quote
1. Where do i store userinformation after login?
(I can't set a cookie and start a session like
in http ;) )
That information is already stored for you. Have you looked at the
TIdFTPServerThread class? It has Username and Password properties, amongst
others.
Quote
2. How can i access this in other events? (like
ListDirectory and so on)
Every event has a TIdFTPServerThread parameter.
Gambit
 

Re:FTPServer Demo

I have my own useraccount in a database with
they rights to access folder and files :(
To your message over other events: this was my
first questions ;)
---------------------------------------------
Thomas Wegner
CabrioMeter - The Weather Plugin for Trillian
www.wegner24.de/cabriometer
"Guillem" <XXXX@XXXXX.COM>schrieb im Newsbeitrag
Quote
Hi,

You should have assigned a TidUserManager for your TidFTPServer, where you
can set user accounts. In this component you will find all info you need
and you can access it from anywhere. Particularly in
TidUserManager1.Accounts you will find what you need.

Another thing you have to do (if you haven't, first time i didn't :) when
using a TidFTP is to assign event handlers for the onRetrieveFile and
onStoreFile events.

Best regards
--
Guillem Vicens
Dep. informática Green Service SA
XXXX@XXXXX.COM
www.clubgreenoasis.com


"Thomas Wegner" <XXXX@XXXXX.COM>escribi?en el mensaje
news:XXXX@XXXXX.COM...
>Hello, was there a Demo for TIdFTPServer?
>
>My first questions:
>
>1. Where do i store userinformation after login?
>(I can't set a cookie and start a session like
>in http ;) )
>2. How can i access this in other events? (like
>ListDirectory and so on)
>
>You see i know the handling in a HTTP Server, but
>there are many questions to use TIdFTPServer. I found
>on my search in the internet, that there are many requests
>for a TIdFTPServer Demo!
>---------------------------------------------
>Thomas Wegner
>CabrioMeter - The Weather Plugin for Trillian
>www.wegner24.de/cabriometer
>


 

Re:FTPServer Demo

Ok, and where I can store my own user information?
Or must I do this internal by my self? Was there a free
"TObject" property in the thread class for custom data?
---------------------------------------------
Thomas Wegner
CabrioMeter - The Weather Plugin for Trillian
www.wegner24.de/cabriometer
"Remy Lebeau (TeamB)" <XXXX@XXXXX.COM>schrieb im Newsbeitrag
Quote

"Thomas Wegner" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...

>1. Where do i store userinformation after login?
>(I can't set a cookie and start a session like
>in http ;) )

That information is already stored for you. Have you looked at the
TIdFTPServerThread class? It has Username and Password properties,
amongst
others.

>2. How can i access this in other events? (like
>ListDirectory and so on)

Every event has a TIdFTPServerThread parameter.


Gambit


 

Re:FTPServer Demo

Well, in that case you could use the OnUserLogin event which gives you
username and password and cross-check with your database to allow access to
determined files and folders. Still I think it would be better to use the
TidUserManager to allow access to your FTP server, and after that decide to
which files your user should have access. You can define a user level for
each user account with the TidUserManager using the Access property. Never
tried it anyway, so you will have to figure out how to do it.
--
Guillem Vicens
Dep. informática Green Service SA
XXXX@XXXXX.COM
www.clubgreenoasis.com
"Thomas Wegner" <XXXX@XXXXX.COM>escribi?en el mensaje
Quote
I have my own useraccount in a database with
they rights to access folder and files :(
To your message over other events: this was my
first questions ;)
---------------------------------------------
Thomas Wegner
CabrioMeter - The Weather Plugin for Trillian
www.wegner24.de/cabriometer

 

Re:FTPServer Demo

"Guillem" <XXXX@XXXXX.COM>writes
Quote
You should have assigned a TidUserManager for your TidFTPServer
That is not a requirement. And that does not address the issue of knowing
which user is actually logged in when events are triggered. Please see my
other reply.
Gambit
 

Re:FTPServer Demo

"Thomas Wegner" <XXXX@XXXXX.COM>writes
Quote
Ok, and where I can store my own user information?
Such as what exactly?
Quote
Or must I do this internal by my self? Was there a free
"TObject" property in the thread class for custom data?
Yes, there is a Data property available. Or you can derive your own class
from TIdFTPServerThread, add whatever extra functionality you want to it,
and then assign the server's ThreadClass property.
Gambit
 

Re:FTPServer Demo

I see in source, that you use the Data property :(
Is that right or have I drink to many "Glühwein" on our
company party ;)? Then I must use the second version.
---------------------------------------------
Thomas Wegner
CabrioMeter - The Weather Plugin for Trillian
www.wegner24.de/cabriometer
"Remy Lebeau (TeamB)" <XXXX@XXXXX.COM>schrieb im Newsbeitrag
Quote

"Thomas Wegner" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...

>Ok, and where I can store my own user information?

Such as what exactly?

>Or must I do this internal by my self? Was there a free
>"TObject" property in the thread class for custom data?

Yes, there is a Data property available. Or you can derive your own class
from TIdFTPServerThread, add whatever extra functionality you want to it,
and then assign the server's ThreadClass property.


Gambit


 

Re:FTPServer Demo

"Thomas Wegner" <XXXX@XXXXX.COM>writes
Quote
I see in source, that you use the Data property :(
What are you talking about?
Gambit
 

Re:FTPServer Demo

I talk about this:
Quote
Yes, there is a Data property available.
Ok, i see that you use the TIdDataChannel.Data, not
the TIdFTPServerContext.Data. Sorry, this was
a fault of me.
I say it: to many party, my last post for today. Sorry again.
---------------------------------------------
Thomas Wegner
CabrioMeter - The Weather Plugin for Trillian
www.wegner24.de/cabriometer
"Remy Lebeau (TeamB)" <XXXX@XXXXX.COM>schrieb im Newsbeitrag
Quote

"Thomas Wegner" <XXXX@XXXXX.COM>writes
news:XXXX@XXXXX.COM...

>I see in source, that you use the Data property :(

What are you talking about?


Gambit


 

Re:FTPServer Demo

Quote
Yes, there is a Data property available.
Ok, the last question. You not destroy the Data
Object in TIdFTPServerContext.Destroy. On which
place (in which event) i must do this. What was the
last event before you destroy TIdFTPServerContext?
---------------------------------------------
Thomas Wegner
CabrioMeter - The Weather Plugin for Trillian
www.wegner24.de/cabriometer
 

Re:FTPServer Demo

"Thomas Wegner" <XXXX@XXXXX.COM>writes
Quote
You not destroy the Data Object in TIdFTPServerContext.Destroy.
Yes, it does. TIdFTPServerContext derives from TIdFTPServerContextBase,
which derives from TIdContext, which derives from TIdTask. The Data
property belongs to TIdTask, and TIdTask.Destroy() does free the Data
object.
Gambit
 

Re:FTPServer Demo

Ok, thank you.
---------------------------------------------
Thomas Wegner
CabrioMeter - The Weather Plugin for Trillian
www.wegner24.de/cabriometer
"Remy Lebeau (TeamB)" <XXXX@XXXXX.COM>schrieb im Newsbeitrag
Quote

"Thomas Wegner" <XXXX@XXXXX.COM>writes
news:41f89343$XXXX@XXXXX.COM...

>You not destroy the Data Object in TIdFTPServerContext.Destroy.

Yes, it does. TIdFTPServerContext derives from TIdFTPServerContextBase,
which derives from TIdContext, which derives from TIdTask. The Data
property belongs to TIdTask, and TIdTask.Destroy() does free the Data
object.


Gambit


 

Re:FTPServer Demo

Thomas Wegner writes:
Quote
Hello, was there a Demo for TIdFTPServer?

Well, I have a start on an FTP Server that I can share with you if you
wish. Remy Lebeau has helped with getting much of it right.