Recent

Author Topic: hey Remy Lebeau indy FTP Server question :-)  (Read 3073 times)

snorkel

  • Hero Member
  • *****
  • Posts: 817
hey Remy Lebeau indy FTP Server question :-)
« on: January 10, 2018, 04:12:13 pm »
Remy,
I sent you a private message about adding some events for the Indy FTP server component.
i.e. OnRetreiveFileDone and OnStoreFileDone.
« Last Edit: January 10, 2018, 04:14:25 pm by snorkel »
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

Thaddy

  • Hero Member
  • *****
  • Posts: 14379
  • Sensorship about opinions does not belong here.
Re: hey Remy Lebeau indy FTP Server question :-)
« Reply #1 on: January 10, 2018, 04:46:56 pm »
I can't see any use for it. Can you add a simple example what you mean? I think you are missing something about the current functionality.
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

snorkel

  • Hero Member
  • *****
  • Posts: 817
Re: hey Remy Lebeau indy FTP Server question :-)
« Reply #2 on: January 11, 2018, 03:38:15 pm »
there are of use if you are building a Managed FTPS/FTP system and you want to do something to the files after they are fully received/stored by the server.
For example:   have a sqlite database with rules based on Unix style pattern matching and then move the files based on stored destinations for those files, or maybe PGP decrypt the files automatically, do a Unix to Windows i.e. LF to CRLF conversion of the file, the list goes on and on.

It's just super nice having the events part of the server component.  Remy suggested doing a new inherited tfilestream object with a custom destroy event and that would probably work. 
But to me it just makes sense to have those two events fire when a file is Sent or Received :-)

I Implemented the events in my copy of Indy almost two years ago and the server has been in production for about 1.5 years and we transfer around 1k files per day and when a file is received I have a I/O completion port queue that does the processing based on the file pattern found in the sqlite database.  No issues with the events ever.
There are natural companions to the OnStoreFile and OnRetreiveFile events.
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

snorkel

  • Hero Member
  • *****
  • Posts: 817
Re: hey Remy Lebeau indy FTP Server question :-)
« Reply #3 on: January 11, 2018, 03:46:12 pm »
Here is the event header for the OnStoreFileDone:

procedure TFTPDataMod.FTP_ServerStoreFileDone(ASender: TIdFTPServerContext;const AFileName: TIdFTPFileName;AFileSize:int64);

No need to create a custom tfilestream object and destructor, which of course would work just fine as well.   

At the time when I created the application it just seemed like a natural addition to the server component.

***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

snorkel

  • Hero Member
  • *****
  • Posts: 817
Re: hey Remy Lebeau indy FTP Server question :-)
« Reply #4 on: January 11, 2018, 08:08:20 pm »
I got it working the way Remy recommended using a custom tfilestream and destructor.
Though I think the events is cleaner.
***Snorkel***
If I forget, I always use the latest stable 32bit version of Lazarus and FPC. At the time of this signature that is Laz 3.0RC2 and FPC 3.2.2
OS: Windows 10 64 bit

 

TinyPortal © 2005-2018