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

Async Webrequests?

Discussion in 'Visual Basic .NET' started by MarketerX, Oct 3, 2011.

  1. MarketerX

    MarketerX Regular Member

    Joined:
    Mar 7, 2010
    Messages:
    398
    Likes Received:
    120
    Can someone post a good tutorial on them, please???

    Synchronous webrequests are super slow when you have a ton of POST requests....:saeek:
     
  2. captchaman

    captchaman Junior Member

    Joined:
    Sep 16, 2010
    Messages:
    190
    Likes Received:
    842
    Occupation:
    Software Programmer
    Location:
    USA
    • Thanks Thanks x 1
  3. MarketerX

    MarketerX Regular Member

    Joined:
    Mar 7, 2010
    Messages:
    398
    Likes Received:
    120
  4. Hydrogen

    Hydrogen Newbie

    Joined:
    Dec 30, 2009
    Messages:
    39
    Likes Received:
    23
    Occupation:
    Co-Owner of AdvertMarketing
    Home Page:
    The reason synchronous requests are slower then asynchronous requests is the way they function. Once you learn why and what each are and how they function can you understand how to use them.

    Synchronous Request : Waits for a response back from the requested server before moving on to your next bit of code. This is good for when you want to 'ENSURE' you have the required information/data to move on to the next step in your program.

    Asynchronous Request: Sends the request and moves on to the next bit of code without waiting on a response, and then handles the response when it finally arrives.

    So each has their own benefits. If you are just blasting out requests and don't care or need to use the response in anyway, then you'll use Asynchronous. On the other hand if your software is dependent on the response back from the server then you'll want to use synchronous. It's all situational and you'll need to determine which option is best for you for what you are doing.

    Now if you decide you have to use Synchronous and want to speed things up and you are writting a bot of some sort, then you may want to look into multi-threading that way you can run multiple requests at the same time none dependent upon the others.