1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

App needs to go to multiple sites at once...should I use background worker?

Discussion in 'Visual Basic 6' started by simpleonline1234, May 16, 2011.

  1. simpleonline1234

    simpleonline1234 Junior Member

    Joined:
    Jan 26, 2010
    Messages:
    169
    Likes Received:
    13
    I've been searching on and off today and for the life of me I can't figure this one out.

    I have an app that is needs to access multiple web sites and sign up for accounts.

    I don't want to run them one by one as this would be slow as christmas so I figured that I could setup some sort of background worker and put each process on it's own thread that way the app could run each sign up page at the same time.

    Would using background worker be the "BEST" option to use for this type of application requirement?

    Thanks
     
  2. Monrox

    Monrox Power Member

    Joined:
    Apr 9, 2010
    Messages:
    615
    Likes Received:
    579
    Yes you need threads. They are only useful when there is some limiting factor outside of your pc's capabilities. If you are ripping a movie, 2 threads won't finish faster than one as the CPU would be maxed out in both cases.

    However & since webservers are usually a lot slower than a normal desktop PC you can easily query even thousands of them at the same time (the actual possible number depends only on your internet connection).

    The backgroundworker is a toned down thread instance to make it easy on the newbies / enable hassle-free workaround for simple multithreaded stuff like UI remaining responsive while counting the words in War and Peace whatever.

    So the 'BEST' option is to use real threads, start with a simple tutorial, and try downloading 5 images from 5 websites with a webclient used by 5 threads or something.
     
  3. Crazy

    Crazy Jr. Executive VIP

    Joined:
    Jun 13, 2009
    Messages:
    640
    Likes Received:
    319
    Occupation:
    VB, C#, XHTML, CSS, PHP, MySQL, JavaScript, jQuery
    Location:
    Everywhere
    VB6 doesn't support true threading. However, this can be easily achieved just arraying Winsock or some other control/library to handle your requests/processing. You can coordinate the pseudo-asynchronous nature of the array with an arrayed timer.

    If you need help just PM me bud.
     
  4. Monrox

    Monrox Power Member

    Joined:
    Apr 9, 2010
    Messages:
    615
    Likes Received:
    579
    He was posting .net code in another thread so I assumed he got the sections mixed up :D
     
  5. simpleonline1234

    simpleonline1234 Junior Member

    Joined:
    Jan 26, 2010
    Messages:
    169
    Likes Received:
    13
    Yeah got em mixed up. I'm using VB.NET on Visual Studio 2008.