Valhalla Legends Forums Archive | Battle.net Bot Development | High Latency and Invalid version?

AuthorMessageTime
Jaquio
For some reason EVERYTIME I connect to bnet on my bot, it has a latency of like.. 400-500ms.. Any idea why? Because when I connect of any other bot it's 50-75ms.. An I cannot figure out why..

Again, it's something that didn't happen on the other bot I made(was outdated needed to start anew), but is happening on this one.. I am sending everything the same.. But not sure why..

Also, when I connect to BNet of anything else other then Starcraft I get invalid version.. Any idea on that? I am using BNLS to get all the information.. Works with starcraft an not anything else.. Again, I think I am sending everything correctly but who knows.. It worked on my other bot an it's the same exact setup(was testing to see if it was my code but it wasn't)..
May 3, 2006, 10:09 PM
Myndfyr
[quote author=Jaquio link=topic=14927.msg151918#msg151918 date=1146694197]
For some reason EVERYTIME I connect to bnet on my bot, it has a latency of like.. 400-500ms.. Any idea why? Because when I connect of any other bot it's 50-75ms.. An I cannot figure out why..

Again, it's something that didn't happen on the other bot I made(was outdated needed to start anew), but is happening on this one.. I am sending everything the same.. But not sure why..

Also, when I connect to BNet of anything else other then Starcraft I get invalid version.. Any idea on that? I am using BNLS to get all the information.. Works with starcraft an not anything else.. Again, I think I am sending everything correctly but who knows.. It worked on my other bot an it's the same exact setup(was testing to see if it was my code but it wasn't)..
[/quote]

Well, it seems to me like you're taking longer than other bots (probably going through a lot more code) to send the SID_PING response.

As to the invalid version info for anything besides Starcraft, you're probably not providing the right information to Battle.net.
May 3, 2006, 10:38 PM
Jaquio
[quote author=MyndFyre[vL] link=topic=14927.msg151919#msg151919 date=1146695918]
Well, it seems to me like you're taking longer than other bots (probably going through a lot more code) to send the SID_PING response.
[/quote]

I send it as soon as I receive it.. Or am I supposed to send it first?

[quote author=MyndFyre[vL] link=topic=14927.msg151919#msg151919 date=1146695918]
As to the invalid version info for anything besides Starcraft, you're probably not providing the right information to Battle.net.
[/quote]

I have provided everything correctly because I did it exactly as I did it in my other bot, an it still don't work? Wtf, lol. I will retry everything again.
May 4, 2006, 12:42 AM
raylu
If you send 0x25 before B.net sends it to you, you get a ping of 0.

I get this when I load SC for the first time after using the computer for a bit. I don't have a lot of RAM so it has to load stuff into virtual memory to pull the hashing function into RAM, I believe. My HD isn't exactly top-of-the-line either, so this takes time...time that delays the 0x25 response.

I've also used SB on a really slow computer. With BNLS, my ping is usually <100, but with local hashing, the ping goes >1000

In short, I believe your hashing function for 0x51 is inefficient.
May 4, 2006, 1:47 AM
Jaquio
[quote author=raylu link=topic=14927.msg151932#msg151932 date=1146707264]
If you send 0x25 before B.net sends it to you, you get a ping of 0.

I get this when I load SC for the first time after using the computer for a bit. I don't have a lot of RAM so it has to load stuff into virtual memory to pull the hashing function into RAM, I believe. My HD isn't exactly top-of-the-line either, so this takes time...time that delays the 0x25 response.

I've also used SB on a really slow computer. With BNLS, my ping is usually <100, but with local hashing, the ping goes >1000

In short, I believe your hashing function for 0x51 is inefficient.
[/quote]

I am using BNLS to do all the hashing for me pretty much..

[code]
Public Sub Send0x51()
    With PB
        .InsertDWORD BNETDat.ClientToken
        .InsertDWORD BNETDat.Version
        .InsertDWORD BNETDat.CheckSum
            If BDat.Product = "PX2D" Or BDat.Product = "PX3W" Then
                .InsertDWORD &H2
            Else
                .InsertDWORD &H1
            End If
        .InsertDWORD &H0
        .InsertNonNTString BNETDat.CDKeyHash
            If BDat.Product = "PX2D" Or BDat.Product = "PX3W" Then
                .InsertNonNTString BNETDat.CDKeyHash2
            End If
        .InsertNTString BNETDat.EXEInfo
        .InsertNTString BDat.CDKeyOwner
        .SendBNCSPacket &H51
    End With
End Sub
[/code]

The information in there comes from the 0x01 an 0x09 packets from BNLS.

[code]
                Case &H1
                    DB.rDWORD 'Result
                   
                    BNETDat.ClientToken = DB.rDWORD
                    BNETDat.CDKeyHash = DB.rVOID(36)
                   
                    Send0x51
           
                Case &H9
                    If DB.rDWORD = &H1 Then
                        BNETDat.Version = DB.rDWORD
                        BNETDat.CheckSum = DB.rDWORD
                        BNETDat.EXEInfo = DB.rNTString
                       
                            If BDat.Product = "PX2D" Or BDat.Product = "PX3W" Then
                                With PB
                                    .InsertDWORD &H0
                                    .InsertBYTE &H2
                                    .InsertDWORD &H1
                                    .InsertDWORD BNETDat.ServerToken
                                    .InsertNTString BDat.CDKey
                                    .InsertNTString BDat.CDKey2
                                    .SendBNLSPacket &HC
                                End With
                            Else
                                With PB
                                    .InsertDWORD BNETDat.ServerToken
                                    .InsertNTString BDat.CDKey
                                    .SendBNLSPacket &H1
                                End With
                            End If
                    Else
                        AddChat vbGreen, vbRed, "BNLS Version Check Failed!"
                        Call frmMain.mnu_Disconnect_Click
                    End If
[/code]

So uhh.. my 0x51 is fine? An I have tried everything.. I send my SID_PING response as soon as I receive it.. I cannot find the problem..

As for the invalid version stuff I cannot figure that out either, but will continue to mess around with it until I get it, I never give up. O_o
May 4, 2006, 5:23 AM
HeRo
this is what i do:
[code]      .send frmMain.sckBNCS, SID_AUTH_INFO
       
        Dim x As Long
            For x = 1 To 710
                .send SID_NULL
            Next x
           
            .InsertDWORD 0
            .send SID_PING
[/code]
May 4, 2006, 7:39 AM
UserLoser
You kids do the weirdest things now a days for these bots...
May 4, 2006, 7:43 AM
laurion
[quote author=HeRo link=topic=14927.msg151949#msg151949 date=1146728354]
this is what i do:
[code]      .send frmMain.sckBNCS, SID_AUTH_INFO
       
        Dim x As Long
            For x = 1 To 710
                .send SID_NULL
            Next x
           
            .InsertDWORD 0
            .send SID_PING
[/code]
[/quote]
wtf?!!!!
May 4, 2006, 10:59 AM
Jaquio
[quote author=Tazo link=topic=14927.msg151952#msg151952 date=1146740364]
[quote author=HeRo link=topic=14927.msg151949#msg151949 date=1146728354]
this is what i do:
[code]       .send frmMain.sckBNCS, SID_AUTH_INFO
       
        Dim x As Long
            For x = 1 To 710
                .send SID_NULL
            Next x
           
            .InsertDWORD 0
            .send SID_PING
[/code]
[/quote]
wtf?!!!!
[/quote]

That is what i'm saying.. What the hell would that do? Lol, anyways.. Still haven't figured it out an now I am getting high pings on all bots. So now I am thinking it's my computer or my connection(Crappy DSL). So who knows.. Will have a friend test it when he gets online, will post back with an answer.

Again, as for the invalid version not sure what is going on with it exactly..
May 4, 2006, 6:54 PM
rabbit
The first time you get SID_PING, set a timer for a few minutes and send your response after that time.  You can do whatever else in the mean time and still get huge lag.
May 4, 2006, 8:44 PM
bethra
[quote author=HeRo link=topic=14927.msg151949#msg151949 date=1146728354]
this is what i do:
[code]      .send frmMain.sckBNCS, SID_AUTH_INFO
       
        Dim x As Long
            For x = 1 To 710
                .send SID_NULL
            Next x
           
            .InsertDWORD 0
            .send SID_PING
[/code]
[/quote]I'm drowning in wtf.
May 4, 2006, 8:52 PM
PaiD
Why wouldnt you get disconnect/ipbanned for sending that many packets(sid_null) or do they not count towards it?
May 4, 2006, 8:54 PM
HdxBmx27
[quote author=Savior link=topic=14927.msg151968#msg151968 date=1146776086]
or do they not count towards it?
[/quote]
They don't, SID_NULLS are all but ignored serverside.
~-~(HDX)~-~
May 4, 2006, 9:14 PM
HeRo
Just try it, when I use it my ping is 30-50, when I dont use it, its about 300+.
May 4, 2006, 11:13 PM
raylu
So why do you send them?
May 4, 2006, 11:22 PM
dRAgoN
[quote author=raylu link=topic=14927.msg151978#msg151978 date=1146784940]
So why do you send them?
[/quote]
Easy way of seeing if your connected to the server still.
May 4, 2006, 11:24 PM
HeRo
[quote author=raylu link=topic=14927.msg151978#msg151978 date=1146784940]
So why do you send them?
[/quote]
Well, If I want a really high ping I use:
[code]                For X = 1 To 99999
                    .Send SID_NULL
                Next X[/code]
If I want a negative one, I just don't send any nulls.
May 5, 2006, 3:13 AM
Jaquio
[quote author=HeRo link=topic=14927.msg151977#msg151977 date=1146784383]
Just try it, when I use it my ping is 30-50, when I dont use it, its about 300+.
[/quote]

When I tried it I had a latency of about 3k.. Lmao. It don't help me at all..

[quote author=HeRo link=topic=14927.msg152002#msg152002 date=1146798822]
[quote author=raylu link=topic=14927.msg151978#msg151978 date=1146784940]
So why do you send them?
[/quote]
Well, If I want a really high ping I use:
[code] For X = 1 To 99999
.Send SID_NULL
Next X[/code]
If I want a negative one, I just don't send any nulls.
[/quote]

Lol,  yea as I stated before, if I just send a sid_null before anything it makes my latency higher..

As for someone else connecting with it, theirs wasn't that high, only 80ms.. So it's not my coding or anything I guess I should have tested that before I posted about it.. Well thanks again everyone sorry for the trouble will post back if I cannot fix the invalid version issue..
May 5, 2006, 3:29 AM
HeRo
Try again, sometimes its high, but I'd say about 90% of the time it isn't.
May 5, 2006, 3:39 AM
Jaquio
I fixed my invalid version problem, I didn't realize that 0x10 returned(1 for STAR, 2 for SEXP, 3 for W2BN,etc).. I thought it returned, "1" or "0".. Anyhow, that is fixed. :)
May 5, 2006, 5:43 AM
Topaz
[quote author=Jaquio link=topic=14927.msg152013#msg152013 date=1146807801]
I fixed my invalid version problem, I didn't realize that 0x10 returned(1 for STAR, 2 for SEXP, 3 for W2BN,etc).. I thought it returned, "1" or "0".. Anyhow, that is fixed. :)
[/quote]

SID_LEAVECHAT?!
May 5, 2006, 6:27 AM
Myndfyr
[quote author=Topaz link=topic=14927.msg152016#msg152016 date=1146810461]
[quote author=Jaquio link=topic=14927.msg152013#msg152013 date=1146807801]
I fixed my invalid version problem, I didn't realize that 0x10 returned(1 for STAR, 2 for SEXP, 3 for W2BN,etc).. I thought it returned, "1" or "0".. Anyhow, that is fixed. :)
[/quote]

SID_LEAVECHAT?!
[/quote]

BNLS 0x10 BNLS_REQUESTVERSIONBYTE.
May 5, 2006, 7:09 AM
Jaquio
[quote author=Topaz link=topic=14927.msg152016#msg152016 date=1146810461]
[quote author=Jaquio link=topic=14927.msg152013#msg152013 date=1146807801]
I fixed my invalid version problem, I didn't realize that 0x10 returned(1 for STAR, 2 for SEXP, 3 for W2BN,etc).. I thought it returned, "1" or "0".. Anyhow, that is fixed. :)
[/quote]

SID_LEAVECHAT?!
[/quote][quote author=MyndFyre[vL] link=topic=14927.msg152017#msg152017 date=1146812981]
[quote author=Topaz link=topic=14927.msg152016#msg152016 date=1146810461]
[quote author=Jaquio link=topic=14927.msg152013#msg152013 date=1146807801]
I fixed my invalid version problem, I didn't realize that 0x10 returned(1 for STAR, 2 for SEXP, 3 for W2BN,etc).. I thought it returned, "1" or "0".. Anyhow, that is fixed. :)
[/quote]

SID_LEAVECHAT?!
[/quote]

BNLS 0x10 BNLS_REQUESTVERSIONBYTE.
[/quote]

Err, yea sorry should have specified which protocol it was for sorry.  :-[
May 5, 2006, 7:26 AM
raylu
Wait...did I miss something? We're talking about some BNLS packet concerning products and Topaz starts talkingabout SID_LEAVECHAT?
May 6, 2006, 3:58 AM
UserLoser
[quote author=HeRo link=topic=14927.msg152002#msg152002 date=1146798822]
[quote author=raylu link=topic=14927.msg151978#msg151978 date=1146784940]
So why do you send them?
[/quote]
Well, If I want a really high ping I use:
[code]                For X = 1 To 99999
                    .Send SID_NULL
                Next X[/code]
If I want a negative one, I just don't send any nulls.
[/quote]

...Why don't you just Sleep() or something...?
May 6, 2006, 4:18 AM
Topaz
[quote author=UserLoser link=topic=14927.msg152062#msg152062 date=1146889138]
[quote author=HeRo link=topic=14927.msg152002#msg152002 date=1146798822]
[quote author=raylu link=topic=14927.msg151978#msg151978 date=1146784940]
So why do you send them?
[/quote]
Well, If I want a really high ping I use:
[code]                For X = 1 To 99999
                    .Send SID_NULL
                Next X[/code]
If I want a negative one, I just don't send any nulls.
[/quote]

...Why don't you just Sleep() or something...?
[/quote]

You crash after a particularly high delay, I think.
May 6, 2006, 4:58 AM
laurion
Credits to MSDN, forgot where I found it or I'd link you. Waits for X seconds without freezing your thread, like Sleep() does.

[code]
Option Explicit

Private Type FILETIME
    dwLowDateTime As Long
    dwHighDateTime As Long
End Type

Private Const WAIT_ABANDONED& = &H80&
Private Const WAIT_ABANDONED_0& = &H80&
Private Const WAIT_FAILED& = -1&
Private Const WAIT_IO_COMPLETION& = &HC0&
Private Const WAIT_OBJECT_0& = 0
Private Const WAIT_OBJECT_1& = 1
Private Const WAIT_TIMEOUT& = &H102&

Private Const INFINITE = &HFFFF
Private Const ERROR_ALREADY_EXISTS = 183&

Private Const QS_HOTKEY& = &H80
Private Const QS_KEY& = &H1
Private Const QS_MOUSEBUTTON& = &H4
Private Const QS_MOUSEMOVE& = &H2
Private Const QS_PAINT& = &H20
Private Const QS_POSTMESSAGE& = &H8
Private Const QS_SENDMESSAGE& = &H40
Private Const QS_TIMER& = &H10
Private Const QS_MOUSE& = (QS_MOUSEMOVE _
                            Or QS_MOUSEBUTTON)
Private Const QS_INPUT& = (QS_MOUSE _
                            Or QS_KEY)
Private Const QS_ALLEVENTS& = (QS_INPUT _
                            Or QS_POSTMESSAGE _
                            Or QS_TIMER _
                            Or QS_PAINT _
                            Or QS_HOTKEY)
Private Const QS_ALLINPUT& = (QS_SENDMESSAGE _
                            Or QS_PAINT _
                            Or QS_TIMER _
                            Or QS_POSTMESSAGE _
                            Or QS_MOUSEBUTTON _
                            Or QS_MOUSEMOVE _
                            Or QS_HOTKEY _
                            Or QS_KEY)

Private Declare Function CreateWaitableTimer Lib "kernel32" _
    Alias "CreateWaitableTimerA" ( _
    ByVal lpSemaphoreAttributes As Long, _
    ByVal bManualReset As Long, _
    ByVal lpName As String) As Long

Private Declare Function OpenWaitableTimer Lib "kernel32" _
    Alias "OpenWaitableTimerA" ( _
    ByVal dwDesiredAccess As Long, _
    ByVal bInheritHandle As Long, _
    ByVal lpName As String) As Long

Private Declare Function SetWaitableTimer Lib "kernel32" ( _
    ByVal hTimer As Long, _
    lpDueTime As FILETIME, _
    ByVal lPeriod As Long, _
    ByVal pfnCompletionRoutine As Long, _
    ByVal lpArgToCompletionRoutine As Long, _
    ByVal fResume As Long) As Long

Private Declare Function CancelWaitableTimer Lib "kernel32" ( _
    ByVal hTimer As Long)

Private Declare Function CloseHandle Lib "kernel32" ( _
    ByVal hObject As Long) As Long

Private Declare Function WaitForSingleObject Lib "kernel32" ( _
    ByVal hHandle As Long, _
    ByVal dwMilliseconds As Long) As Long

Private Declare Function MsgWaitForMultipleObjects Lib "user32" ( _
    ByVal nCount As Long, _
    pHandles As Long, _
    ByVal fWaitAll As Long, _
    ByVal dwMilliseconds As Long, _
    ByVal dwWakeMask As Long) As Long
Public Sub Wait(lNumberOfSeconds As Long)
    Dim ft As FILETIME
    Dim lBusy As Long
    Dim lRet As Long
    Dim dblDelay As Double
    Dim dblDelayLow As Double
    Dim dblUnits As Double
    Dim hTimer As Long

    hTimer = CreateWaitableTimer(0, True, App.EXEName & "Timer")

    If Err.LastDllError = ERROR_ALREADY_EXISTS Then
        ' If the timer already exists, it does not hurt to open it
        ' as long as the person who is trying to open it has the
        ' proper access rights.
    Else
        ft.dwLowDateTime = -1
        ft.dwHighDateTime = -1
        lRet = SetWaitableTimer(hTimer, ft, 0, 0, 0, 0)
    End If

    ' Convert the Units to nanoseconds.
    dblUnits = CDbl(&H10000) * CDbl(&H10000)
    dblDelay = CDbl(lNumberOfSeconds) * 1000 * 10000

    ' By setting the high/low time to a negative number, it tells
    ' the Wait (in SetWaitableTimer) to use an offset time as
    ' opposed to a hardcoded time. If it were positive, it would
    ' try to convert the value to GMT.
    ft.dwHighDateTime = -CLng(dblDelay / dblUnits) - 1
    dblDelayLow = -dblUnits * (dblDelay / dblUnits - _
        Fix(dblDelay / dblUnits))

    If dblDelayLow < CDbl(&H80000000) Then
        ' &H80000000 is MAX_LONG, so you are just making sure
        ' that you don't overflow when you try to stick it into
        ' the FILETIME structure.
        dblDelayLow = dblUnits + dblDelayLow
        ft.dwHighDateTime = ft.dwHighDateTime + 1
    End If

    ft.dwLowDateTime = CLng(dblDelayLow)
    lRet = SetWaitableTimer(hTimer, ft, 0, 0, 0, False)

    Do
        ' QS_ALLINPUT means that MsgWaitForMultipleObjects will
        ' return every time the thread in which it is running gets
        ' a message. If you wanted to handle messages in here you could,
        ' but by calling Doevents you are letting DefWindowProc
        ' do its normal windows message handling---Like DDE, etc.
        lBusy = MsgWaitForMultipleObjects(1, hTimer, False, _
            INFINITE, QS_ALLINPUT&)
        DoEvents
    Loop Until lBusy = WAIT_OBJECT_0

    ' Close the handles when you are done with them.
    CloseHandle hTimer

End Sub

[/code]
May 6, 2006, 5:04 PM
Myndfyr
[quote author=Tazo link=topic=14927.msg152080#msg152080 date=1146935056]
Credits to MSDN, forgot where I found it or I'd link you. Waits for X seconds without freezing your thread, like Sleep() does.
[/quote]

Or... you could use a good language that supports multithreading!  :P
May 6, 2006, 8:11 PM

Search