• Welcome to Valhalla Legends Archive.
 

Verification server

Started by PaiD, February 15, 2003, 06:30 PM

Previous topic - Next topic

PaiD

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

sOuLz

#1
vb im guessing?  use the inet functions.

PaiD

#2
inet?

Guest

#3
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.

PaiD

#4
i c. Could i set up inet to get news about my bot too?

Guest

#5
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

Camel

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)

Noodlez

#7
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.

iago

#8
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.
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Camel

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?  ;))

Atom

#10
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?
I am back! aINC is dead, ThinkTank PRO is alive.
VB, JAVA, ASM, C, its all yummy to me.

Camel

#11
i *know* how to do that; that doesnt make the server any faster
it's got a shitty host

Camel

#12
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.

Noodlez

#13
theres a solution to that- use winsock.

btw, theres an edit button. you didn't need to make 3 posts all containing 1 sentence

warz

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.