I'm trying to learn the proper way to implement a constantly running thread for an FTP Client application. I need run an Indy FTP client control (TIdFTP) in a thread. Being that the FTP control maintains a connection (login) to the server, the thread would need to be constantly running and execute "commands" (Dir list, Change dir, upload, etc). Do I simply create a system of looping in the Execute procedure and watch a property I create to know when to do things? I looked into TIdThreadComponent, but could not find any documentation.

I'm trying to learn the proper way to implement a constantly running thread for an FTP Client application. I need run an Indy FTP client control (TIdFTP) in a thread. Being that the FTP control maintains a connection (login) to the server, the thread would need to be constantly running and execute "commands" (Dir list, Change dir, upload, etc). Do I simply create a system of looping in the Execute procedure and watch a property I create to know when to do things? I looked into TIdThreadComponent, but could not find any documentation.
I've done a bunch of searching, but the terms are so generic that I wasn't able to find the answer.
This is XE8, Firemonkey. Targets are Windows and OSX.

Comments

  1. If I understand well, the FTP thread is a worker thread and the main thread submit task to it.

    you can have a Task list in the main thread
    the thread use Synchronize to peek a task from the list
    if the list is empty you can use a TEvent put the thread in a waiting state, but don't forget to pulse the event when you add a new task.

    ReplyDelete
  2. Why in this day and age of security awareness use FTP?

    ReplyDelete
  3. Because the client sells an FTP Client and they want a cross platform version.

    ReplyDelete

Post a Comment