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

webrequests vs sockets

Discussion in 'C, C++, C#' started by something77, Sep 26, 2011.

  1. something77

    something77 Registered Member

    Joined:
    Jan 6, 2010
    Messages:
    73
    Likes Received:
    10
    I have httpwebrequests fairly nailed down for what I have needed to do up to now (simple scraping, posting etc). During this learning period I have got the impression from the odd comments here and there that sockets are a better way to do things. However, I have never seen an explanation of why. Infact, I had read explanations (of stackoverflow) that sockets may not be better for all situations.

    From my very basic knowledge (could be (probably is) wrong, sockets allow you to keep a port open and constantly listen for information. But why would you want to do this for a spam tool?
     
  2. smack

    smack Junior Member

    Joined:
    Feb 1, 2010
    Messages:
    182
    Likes Received:
    78
    Occupation:
    Software Engineer/Evil Genius
    Location:
    inside .NET
    sockets are better for a number of reasons.

    first and foremost they give you full control over all your actions you're taking. create a good wrapper class for raw sockets and the sky is the limit.

    they're faster than HTTPWebRequest, more efficient, more reliable, and loads more powerful.

    you can work with them synchronously or asynchronously.

    the list goes on and on.
     
  3. turtleneck

    turtleneck Newbie

    Joined:
    Sep 13, 2011
    Messages:
    1
    Likes Received:
    1
    This is a bit old but oh well.....
    It depends on what you want to do.
    If all you do is making web requests, stick to them.
    It takes a lot of work off your hands.
    It is not about beeing 1337 and beeing able to do everything as close to the metal as possible.
    It is about beeing productive.
    It is of course good to be able to do it , but only if absolutly necessary.
    so no sweat about using webrequests.
     
    • Thanks Thanks x 1