Valhalla Legends Forums Archive | Battle.net Bot Development | 16ms Ping (odd for me)

AuthorMessageTime
CrAz3D
I'm thinking this is just a random fluke in my code, but I don't know.

Sometimes, when I try to login with 0ms ping I end up with 16ms instead. This strikes me as odd since I have dial-up.

[code]Public Sub p0x50()
Form1.sckBNET.SendData Chr(1)
InsertDWORD 0
InsertNonNTString "68XI" & varProduct
InsertDWORD "&H" & GetVerByte()
InsertDWORD &H0
InsertDWORD &H0
InsertDWORD &H0
InsertDWORD &H0
InsertDWORD &H0
InsertNTString "USA"
InsertNTString "United States"
sendPacket &H50
If frmLogin.chk0Ping.Value = vbChecked Then
InsertDWORD &H0
sendPacket &H25
End If
End Sub[/code]


This is recieving 0x25
[code]Case &H25
If frmLogin.chk1Ping.Value = vbChecked Then
ElseIf frmLogin.chk0Ping.Value = vbChecked Then
Else
InsertNonNTString Mid(data, 5, 4)
sendPacket &H25
End If[/code]

Any ideas why this happens?
July 5, 2004, 9:48 PM
Soul Taker
Try packet logging it. If you're sending 0x50 and 0x25 in two seperate clumps, I'm sure it's just your connection being a little slow.
July 5, 2004, 10:28 PM
BinaryzL
Yeah that happened to me a couple times.
July 6, 2004, 4:48 AM
LoRd
Should disable the Nagel Algorithim when connecting and ew at using an object to determine whether or not to spoof the ping.
July 6, 2004, 4:59 AM
DeCeP7ioN
This happens to me when using a slow proxy or a slow dial-up connection.

You are sending 0x25 to Battle.net before Battle.net sends it to you to get 0 ms ping time. However, since your connection is so slow, Battle.net actually doesn't get your 0x25 until right after it has sent 0x25 to you.

That is why you are getting 16 ms ping time.
July 6, 2004, 5:21 AM
iago
[quote author=LoRd[nK] link=board=17;threadid=7579;start=0#msg68766 date=1089089986]
Should disable the Nagel Algorithim[/quote]
Agreed - ping should never be clumped.

[quote]ew at using an object to determine whether or not to spoof the ping.
[/quote]
What's wrong with giving the user a checkbox to ask if they want the ping spoofed?


Also, ping time has nothing to do with what type of connection your on. You can have a dialup connection and a slow ping, as long as nothing else is plugging up the stream. Ping is based on the time it takes for a tiny bit of data to be transferred, and has more to do with distance.
July 6, 2004, 5:23 AM
Lenny
Actually, in order to get the 0ms ping, you may want to have the Nagel enabled...You need the 0x25 packet to be clumped with 0x50.
If they are sent separately, the chances Battle.net will send 0x25 before it recieves your 0x25 will be greater.
July 6, 2004, 7:56 AM
Tuberload
If you handle the clumped packets correctly I don't see why they are a problem.
July 6, 2004, 8:28 AM
LoRd
[quote]Quote:
ew at using an object to determine whether or not to spoof the ping.


What's wrong with giving the user a checkbox to ask if they want the ping spoofed?[/quote]

Programming 101: Don't use objects in functions because the object names may need to be changed or removed sometime in the future and in which case you'd have to hunt down the functions that contain the object and change them. Checking objects also takes a much longer time to check than a variable.

CrAz3D: A packet log may be helpful.
July 6, 2004, 8:34 AM
Arta
[quote author=Lenny link=board=17;threadid=7579;start=0#msg68784 date=1089100619]
Actually, in order to get the 0ms ping, you may want to have the Nagel enabled...You need the 0x25 packet to be clumped with 0x50.
If they are sent separately, the chances Battle.net will send 0x25 before it recieves your 0x25 will be greater.
[/quote]

That's incorrect. Battle.net won't send 0x25 until it receives your initial logon packet (SID_AUTH_INFO or similar). By disabling Nagle, you ensure that your ping packet is sent immediately, and can then wait an appropriate amount of time before proceeding with your logon as normal.
July 6, 2004, 8:54 AM
iago
[quote author=LoRd[nK] link=board=17;threadid=7579;start=0#msg68789 date=1089102840]
[quote]Quote:
ew at using an object to determine whether or not to spoof the ping.


What's wrong with giving the user a checkbox to ask if they want the ping spoofed?[/quote]

Programming 101: Don't use objects in functions because the object names may need to be changed or removed sometime in the future and in which case you'd have to hunt down the functions that contain the object and change them. Checking objects also takes a much longer time to check than a variable.

CrAz3D: A packet log may be helpful.
[/quote]

Where do you suggest reading the checkbox? Passing it as a parameter would be dirty, and saving it in a global variable temporarely would even worse (having a copy of it that you might forget to update, etc.).
July 6, 2004, 12:13 PM
St0rm.iD
Lord: VB comes before Programming 101 :)
July 6, 2004, 4:35 PM
CrAz3D
It doesn't always happen, that is why there is no packet log.
July 6, 2004, 4:39 PM
Lenny
[quote author=Arta[vL] link=board=17;threadid=7579;start=0#msg68792 date=1089104086]
[quote author=Lenny link=board=17;threadid=7579;start=0#msg68784 date=1089100619]
Actually, in order to get the 0ms ping, you may want to have the Nagel enabled...You need the 0x25 packet to be clumped with 0x50.
If they are sent separately, the chances Battle.net will send 0x25 before it recieves your 0x25 will be greater.
[/quote]

That's incorrect. Battle.net won't send 0x25 until it receives your initial logon packet (SID_AUTH_INFO or similar). By disabling Nagle, you ensure that your ping packet is sent immediately, and can then wait an appropriate amount of time before proceeding with your logon as normal.
[/quote]

But won't clumping your 0x25 with your SID_AUTH_INFO ensure it recieves 0x25 immediately after SID_AUTH_INFO...
July 7, 2004, 3:46 AM
KkBlazekK
What would happen if you sent 0x25 before 0x50?
July 7, 2004, 10:52 PM
BinaryzL
[quote author=Kk)Blaze(kK [Anti-yL] link=board=17;threadid=7579;start=0#msg69069 date=1089240757]
What would happen if you sent 0x25 before 0x50?
[/quote]

Why don't you try it..I would assume an IP ban.
July 8, 2004, 1:12 AM
Myndfyr
[quote author=LoRd[nK] link=board=17;threadid=7579;start=0#msg68789 date=1089102840]
Programming 101: Don't use objects in functions because the object names may need to be changed or removed sometime in the future and in which case you'd have to hunt down the functions that contain the object and change them. Checking objects also takes a much longer time to check than a variable.
[/quote]

That's retarded. Why even have object-oriented programming then? (Java pros back me up here!) My code is nice and clean because I have well-defined interfaces. My documentation is clear -- my ConfigurationSettings class is responsible for maintaining all configuration information (including connection behavior, plugin settings, and display settings; by supporting several different interfaces) so that I don't need to know how that data is stored and persisted. The class takes care of loading and saving that data transparently (I've programmed it that way), and so all I need to do is
[code]
settings.Username

settings->Username
[/code]
etc
to access the username.

It's ludicrous to say that it's SOOOO much slower to access a variable through an object than directly. So what if you use indirect addressing? What's the problem:
[code]
mov eax, 8402EC22H ; move the this pointer into the eax register
add eax, 12H ; add the offset of the b_spoof variable
mov ebx, [eax]
test ebx, ebx
jz do_spoof
[/code]

Most compilers would optimize it immediately to (if you didn't need to worry about several instances of this object):
[code]
mov ebx, [8402EC34H] ; move the pointer to the b_spoof variable offset of this into the ebx register
test ebx, ebx
jz do_spoof
[/code]

Goodness no! Three instructions! Probably the same as if you had just to index into memory. In fact, exactly the same number of instructions as if you just read directly from memory.

Programming 101: Avoid using global data when possible because down the line if you change the one global data variable name you have to hunt through the program for every occurance of that identifier.
July 8, 2004, 1:29 AM
Tuberload
I think he was talking about Visual Basic controls when he said objects, but yes Mydfyre I agree with you completely about object oriented programming. It is amazing what you can do with a little bit of inheritance and splash of polymorphism. Plus the organization and structure of the coding to me is way nicer than a procedural language, and whatever VB6 and below is(?). Another benefit, for me anyways, is that I can actually visualize my program in terms of physical objects. To me it's like putting together a motor when I design my programs.
July 8, 2004, 2:11 AM
LoRd
[quote]I think he was talking about Visual Basic controls when he said objects[/quote]
Exactly.
July 8, 2004, 3:19 AM
Myndfyr
[quote author=LoRd[nK] link=board=17;threadid=7579;start=15#msg69129 date=1089256758]
[quote]I think he was talking about Visual Basic controls when he said objects[/quote]
Exactly.
[/quote]

Ahh, that makes a little more sense (controls v. objects). Yes, that is retarded.
July 8, 2004, 3:23 AM
KkBlazekK
[quote author=BinaryzL link=board=17;threadid=7579;start=15#msg69102 date=1089249143]
[quote author=Kk)Blaze(kK [Anti-yL] link=board=17;threadid=7579;start=0#msg69069 date=1089240757]
What would happen if you sent 0x25 before 0x50?
[/quote]

Why don't you try it..I would assume an IP ban.
[/quote]

Damn... Stop being so right!
July 9, 2004, 2:13 AM
tA-Kane
[quote author=LoRd[nK] link=board=17;threadid=7579;start=0#msg68789 date=1089102840]Programming 101: Don't use objects in functions because the object names may need to be changed or removed sometime in the future and in which case you'd have to hunt down the functions that contain the object and change them. Checking objects also takes a much longer time to check than a variable.[/quote]DOUBLE YOU TEE EFF?!?! That's total nonsense...

I normally ignore stupidity, but this takes the cake... you couldn't be much more dead wrong...

"Don't use objects in functions" ... where the freak else would you use an object??

"object names may need to be changed or removed sometime in the future and in which case you'd have to hunt down the functions that contain the object and change them." ... that's PART OF PROGRAMMING...

"Checking objects also takes a much longer time to check than a variable." ... hardly. So instead of having a variable in the register, you have the address of the object in the register (your object). So instead of having to simply check the register, you have to load the data and then check. Whoop-dee-freaking-doo. Might I also mention that an object can have countless more variables than you can have variables in the few registers that most Windows machines have (or just about any machine for that matter), so if you were to have a lot of variables, you'd have to have (at least some of) them on the stack anyways. In this case, you'd STILL have to load the parameter from the stack first, and then check.


If what you say is truly "Programming 101", then there's no wonder there's so many newbie programmers today.


Edit: Ugh, I should read page two before posting my own rant along the exact same lines as already discussed :\
July 13, 2004, 1:16 AM
Tuberload
[quote author=tA-Kane link=board=17;threadid=7579;start=15#msg70080 date=1089681393]object names may need to be changed or removed sometime in the future and in which case you'd have to hunt down the functions that contain the object and change them." ... that's PART OF PROGRAMMING...[/quote]

If you use inheritance and polymorphism, and design your program correctly you can greatly reduce the amount of maintenance required on previously developed objects. I rarely have to go back and modify anything in my object library unless I need to add functionality or fix a bug somewhere in the underlying details. That is the beauty of OOP.
July 13, 2004, 1:23 AM
LoRd
[quote]"Don't use objects in functions" ... where the freak else would you use an object??[/quote]
You declare the object and pass only the needed variable(s) to the function saving memory and CPU overhead, or as discussed in the previous posts, storing the variable(s)/function(s) in a module.

IMO, a function concerning sending a packet to Battle.net should not have to access a visual on a configuration form.

[quote]"object names may need to be changed or removed sometime in the future and in which case you'd have to hunt down the functions that contain the object and change them." ... that's PART OF PROGRAMMING...[/quote]
One of the main goals when programming is cleanlieness.
July 13, 2004, 3:17 AM
Myndfyr
[quote author=LoRd[nK] link=board=17;threadid=7579;start=15#msg70116 date=1089688659]
One of the main goals when programming is cleanlieness.
[/quote]

While I agree with other things that you said, I have to point it out....

Clean code that doesn't function is no good.
July 13, 2004, 4:07 AM
Adron
[quote author=LoRd[nK] link=board=17;threadid=7579;start=15#msg70116 date=1089688659]
You declare the object and pass only the needed variable(s) to the function saving memory and CPU overhead, or as discussed in the previous posts, storing the variable(s)/function(s) in a module.
[/quote]

I'd like to point out that passing an object reference to a function will cause less overhead than extracting five different variables from the object and passing them...
July 13, 2004, 2:50 PM

Search