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

Need help with the sending delay of my spam bot in VB.net

Discussion in 'General Programming Chat' started by VBLearner, Sep 19, 2013.

  1. VBLearner

    VBLearner Newbie

    Joined:
    Sep 19, 2013
    Messages:
    6
    Likes Received:
    0
    My code would auto fill-up a web form and submit it.

    Here is my code:

    Code:
                [COLOR=#00008B]Dim[/COLOR] cweb [COLOR=#00008B]As[/COLOR] [COLOR=#00008B]String[/COLOR] = [COLOR=#800000]Textbox1.Text[/COLOR]
                [COLOR=#00008B]Dim[/COLOR] POST [COLOR=#00008B]As[/COLOR] [COLOR=#00008B]String[/COLOR] = [COLOR=#800000]Textbox2.Text[/COLOR]
    
                [COLOR=#00008B]Dim[/COLOR] request [COLOR=#00008B]As[/COLOR] HttpWebRequest
                [COLOR=#00008B]Dim[/COLOR] response [COLOR=#00008B]As[/COLOR] HttpWebResponse
    
                request = [COLOR=#00008B]CType[/COLOR](WebRequest.Create(cweb), HttpWebRequest)
                request.UserAgent = [COLOR=#800000]"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.72 Safari/537.36"[/COLOR]
                request.AllowAutoRedirect = [COLOR=#800000]True[/COLOR]
                request.ContentType = [COLOR=#800000]"application/x-www-form-urlencoded"[/COLOR]
                request.ContentLength = POST.Length
                request.Method = [COLOR=#800000]"POST"[/COLOR]
                request.KeepAlive = [COLOR=#800000]True[/COLOR]
    
                [COLOR=#00008B]Dim[/COLOR] requestStream [COLOR=#00008B]As[/COLOR] Stream = request.GetRequestStream()
                [COLOR=#00008B]Dim[/COLOR] postBytes [COLOR=#00008B]As[/COLOR] [COLOR=#00008B]Byte[/COLOR]() = Encoding.ASCII.GetBytes(POST)
                requestStream.Write(postBytes, [COLOR=#800000]0[/COLOR], postBytes.Length)
                requestStream.Close()
    
                response = [COLOR=#00008B]CType[/COLOR](request.GetResponse(), HttpWebResponse)
                response.Close()
    My problem is that it has a sending delay of 1 - 3 seconds. I want to get rid of the delay so i can spam it contiuously.
     
  2. FJX

    FJX Jr. VIP Jr. VIP Premium Member

    Joined:
    Oct 13, 2011
    Messages:
    356
    Likes Received:
    186
    Location:
    0x90
    I do not see any delay in the code. But if you're talking about the delay of sending request after another, it's because you are waiting for the response from your request.
     
  3. xenergy81

    xenergy81 Junior Member

    Joined:
    Jul 6, 2009
    Messages:
    105
    Likes Received:
    6
    Occupation:
    Full time Online Marketer & Software Engineer
    Location:
    IPv4
    Try to implement multi-threading in you code. Each request is handled by single thread, then your bot would not have delay between requests anymore.