Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. FTP download and bacgroundworker

FTP download and bacgroundworker

Scheduled Pinned Locked Moved C#
question
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    peropata
    wrote on last edited by
    #1

    Hi, In my application, I use FTP do download single .txt file from multiple devices (up to 100 devices, each with its own IP_adress). At the moment I use single bacground worker, which contains single for loop and goes from first to last device and downloads file to local computer (size of each file up to 5 MB). Is it better to implement separate backgroudworker for each device, and download files simultaneously and what would be the best approach?

    H M L 3 Replies Last reply
    0
    • P peropata

      Hi, In my application, I use FTP do download single .txt file from multiple devices (up to 100 devices, each with its own IP_adress). At the moment I use single bacground worker, which contains single for loop and goes from first to last device and downloads file to local computer (size of each file up to 5 MB). Is it better to implement separate backgroudworker for each device, and download files simultaneously and what would be the best approach?

      H Offline
      H Offline
      Herman T Instance
      wrote on last edited by
      #2

      Maybe this lnk http://www.microsoft.com/uk/msdn/screencasts/screencast/294/how-to-use-task-and-taskmanager-classes.aspx[^] helps you out. It is about Task and TaskManager in .NET. You can then make these downloads based from a queue. Please see the video in the link before you respond to me.

      In Word you can only store 2 bytes. That is why I use Writer.

      1 Reply Last reply
      0
      • P peropata

        Hi, In my application, I use FTP do download single .txt file from multiple devices (up to 100 devices, each with its own IP_adress). At the moment I use single bacground worker, which contains single for loop and goes from first to last device and downloads file to local computer (size of each file up to 5 MB). Is it better to implement separate backgroudworker for each device, and download files simultaneously and what would be the best approach?

        M Offline
        M Offline
        musefan
        wrote on last edited by
        #3

        Personally I would stick with downloading one file at a time. You still have to transfer same about of data so it is not like it will be any quicker to download simultaneously

        Life goes very fast. Tomorrow, today is already yesterday.

        1 Reply Last reply
        0
        • P peropata

          Hi, In my application, I use FTP do download single .txt file from multiple devices (up to 100 devices, each with its own IP_adress). At the moment I use single bacground worker, which contains single for loop and goes from first to last device and downloads file to local computer (size of each file up to 5 MB). Is it better to implement separate backgroudworker for each device, and download files simultaneously and what would be the best approach?

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          This "problem" is basically the same as your earlier one, so I suggest you read this thread[^] again! :)

          Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

          Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

          P 1 Reply Last reply
          0
          • L Luc Pattyn

            This "problem" is basically the same as your earlier one, so I suggest you read this thread[^] again! :)

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

            Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

            P Offline
            P Offline
            peropata
            wrote on last edited by
            #5

            I agree it is similar, but not exactly the same. For pinging I used for loop with PingIP.DoAsyncPing(IPadress[i]); and it works asynchronous. I guess I could create backgroundworkers dynamically (for each ftp download) and run them asynchronous. As I am new to multithreading, I still having trouble differentiating between backgroundworker, thread, thread pool, tasks ... Basicly I want to create multithread application with different threads (tasks): 1) scan network for devices (if connected) 2) download files using ftp 3) read from files 4) processing file content 5) some actions, based upon proccessed data

            L 1 Reply Last reply
            0
            • P peropata

              I agree it is similar, but not exactly the same. For pinging I used for loop with PingIP.DoAsyncPing(IPadress[i]); and it works asynchronous. I guess I could create backgroundworkers dynamically (for each ftp download) and run them asynchronous. As I am new to multithreading, I still having trouble differentiating between backgroundworker, thread, thread pool, tasks ... Basicly I want to create multithread application with different threads (tasks): 1) scan network for devices (if connected) 2) download files using ftp 3) read from files 4) processing file content 5) some actions, based upon proccessed data

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              peropata wrote:

              I used for loop with PingIP.DoAsyncPing(IPadress[i]);

              that wasn't my recommendation.

              peropata wrote:

              I could create backgroundworkers dynamically (for each ftp download)

              That would be very expensive. Read the other thread again!

              peropata wrote:

              I still having trouble differentiating between backgroundworker, thread, thread pool

              They basically are all the same. ThreadPool lends you pre-existing threads (that is cheaper) with very little control. BackgroundWorker is a Thread with some goodies added to it, would probably be OK for your needs. Warning: BGW needs several properties set true before it starts behaving well! :)

              Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

              Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

              P 1 Reply Last reply
              0
              • L Luc Pattyn

                peropata wrote:

                I used for loop with PingIP.DoAsyncPing(IPadress[i]);

                that wasn't my recommendation.

                peropata wrote:

                I could create backgroundworkers dynamically (for each ftp download)

                That would be very expensive. Read the other thread again!

                peropata wrote:

                I still having trouble differentiating between backgroundworker, thread, thread pool

                They basically are all the same. ThreadPool lends you pre-existing threads (that is cheaper) with very little control. BackgroundWorker is a Thread with some goodies added to it, would probably be OK for your needs. Warning: BGW needs several properties set true before it starts behaving well! :)

                Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

                Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

                P Offline
                P Offline
                peropata
                wrote on last edited by
                #7

                So if I understand correctly, it is better to use one background worker (or split between just a few workers).

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups