Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: PaiD on February 15, 2003, 06:30 PM

Title: Verification server
Post by: PaiD on February 15, 2003, 06:30 PM
ok how would i set up my bot to connect to a site or server before to check if it is a legit copy of the bot? This would be before it connected to battle.net
Title: Re: Verification server
Post by: sOuLz on February 16, 2003, 01:24 PM
vb im guessing?  use the inet functions.
Title: Re: Verification server
Post by: PaiD on February 16, 2003, 02:18 PM
inet?
Title: Re: Verification server
Post by: Guest on February 16, 2003, 02:31 PM
its a vb ocx u can add it to your project, where u can get stuff from the internet like read a txt uploaded somewhere and set it to a text box on a form when it receives it.
Title: Re: Verification server
Post by: PaiD on February 16, 2003, 04:07 PM
i c. Could i set up inet to get news about my bot too?
Title: Re: Verification server
Post by: Guest on February 16, 2003, 04:23 PM
yes.. all u do is upload news.txt to a brinkster or whatever free web host and use it to get whast in text file

Dim Site As String
Dim strNews As String
Site = "http://www33.brinkster.com/BLEHBLEHWHATEVER/"
txtNews.Text = Replace(Inet1.OpenURL(Site & "news.txt"), Chr(10), vbCrLf)
strNews = txtNews.Text
Title: Re: Verification server
Post by: Camel on February 22, 2003, 10:56 AM
stripped down version of what i'm using

Public Function CheckVer() As Boolean
    Dim URL As String
    URL = "http://www.clanbnu.net/bnubotcheck.php"
    URL = URL & _
        "?app=" & App.Title & _
 _
        "&ver1=" & App.Major & _
        "&ver2=" & App.Minor & _
        "&ver3=" & App.Revision
    
    CheckVer = CheckVerPart2(URL)
...
Public Function CheckVerPart2(URL As String) As Boolean
    CheckVerPart2 = False
    TXT = ""
    
    frmSetup.Inet1.Execute URL
        
    While frmSetup.Inet1.StillExecuting
        Sleep 100
        DoEvents 'play fair...
    Wend
    
    Dim resp As String
    On Error Resume Next
    resp = frmSetup.Inet1.GetChunk(65535)  '1024)
    
    If Len(resp) = 0 Then
        MsgBox "Error in version check; The server may be down."
        End
    Else
(code that parses the response)
Title: Re: Verification server
Post by: Noodlez on February 22, 2003, 08:15 PM
thats like... horrible. why would you put sleep on a loop?! your stopping your program for quite some time depending on the speed of the webserver. instead, in the inet(eww!) data arrival event, just grab the stuff there.
Title: Re: Verification server
Post by: iago on February 22, 2003, 10:55 PM
Quotethats like... horrible. why would you put sleep on a loop?! your stopping your program for quite some time depending on the speed of the webserver. instead, in the inet(eww!) data arrival event, just grab the stuff there.

To be fair, at least sleep gives up the rest of the thread's time-slice in the operating system, so it doesn't work at 100% cpu while it's waiting.
Title: Re: Verification server
Post by: Camel on February 23, 2003, 05:58 AM
bingo; the server is slow
sleep and doevents do totally different thing and give simmilar effects. sleep STOPS the program for x miliseconds. doevents just 'tricks' the system into thinking it's time to move on to the next running thread. if no other programs are running, a loop with only doevents in it can cause major cpu hoggage (hoggitude? hoggification?  ;))
Title: Re: Verification server
Post by: Atom on February 23, 2003, 08:14 AM
I posted on the forums before code to properly make an http request using a winsock control... maybe you can do a search for it?
Title: Re: Verification server
Post by: Camel on February 23, 2003, 08:52 AM
i *know* how to do that; that doesnt make the server any faster
it's got a shitty host
Title: Re: Verification server
Post by: Camel on February 23, 2003, 09:05 AM
and noodles, inet has no data arrival event, only a statechanged event. and htere's like a zillion different states that all mean one of two things. my code is MUCH simpler.
Title: Re: Verification server
Post by: Noodlez on February 24, 2003, 12:29 PM
theres a solution to that- use winsock.

btw, theres an edit button. you didn't need to make 3 posts all containing 1 sentence
Title: Re: Verification server
Post by: warz on February 24, 2003, 02:04 PM
Noodlez, he posted a total of three messages, all containing more than one sentence. Come on guys, lets learn how to count before flaming on here.
Title: Re: Verification server
Post by: haZe on February 24, 2003, 02:30 PM
huh, warz? anyways,
Private Sub connect_click()
Inet1.OpenURL "the site to check"
IF Inet1.OpenURL = Text1.Text then RealConnect
Else
winsock1.close
addtext "Verification or w/e failed"
for realconnect, you would add a function that connects.
you would make text1 invisible, and make the text whatever the inet connects to. Not very reliable and probably very easy to crack, but hey, i TRIED to give my 2cents. =p
Title: Re: Verification server
Post by: Banana fanna fo fanna on February 25, 2003, 11:14 AM
Noodlez, that post was redundant. I'm sorry  :'(