why do you get No Battle.net connection detected? your not connected to bncs or mcp?
BNCS? How can MCP tell you if you're not connected to MCP?
???
What packets do you need to send before you start sendind packets through MCP?
Well, BnetDocs (http://bnetdocs.valhallalegends.com) discusses three packets used on the chat server related to realm communications: SID_QUERYREALMS (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=7), SID_QUERYREALMS2 (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=395), and SID_LOGONREALMEX (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=14). If I was interested I might have searched (http://forum.valhallalegends.com/index.php?action=search) the forum for some information about these packets.
The documentation on 0x34 is poor can someone please make it clear to me
Message information: SID_QUERYREALMS (0x34)
Message ID: 0x34
Message Name: SID_QUERYREALMS
Direction: Client -> Server (Sent)
Used By: Diablo II, Diablo II LOD
(DWORD) Unused (0)
(DWORD) Unused (0)
(STRING) Unknown (empty)
What are Unusde (0) and Unknown (empty) equal too?
There equil to 0x00 and NULL Respectivly.
Basically uour sending a packet with 9 null bytes.
FF 34 0D 00 00 00 00 00 00 00 00 00 00
~-~(HDX)~-~
Use 0x40 (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=395)
So do you even have to send 0x34?
Right after you send 0x0A you send 0x40 and when you get 0x40 you send 3E when you pharse 3E you get the ip and connecto that that througt that and start sending MCP packets..
0x40 replaces 0x34. The truth is you don't have to send either packet and just send 0x3E since you could make a function to determine which realm you are connecting to instead of sending the packet. Ex: if you connect to useast.battle.net, the realm would be USEast.
Aren't there like 3 Asia servers though? Would you always connect to the same Asian Realm server or does it assign differently each time?
Quote from: LivedKrad.fe on November 23, 2005, 11:57 AM
Aren't there like 3 Asia servers though? Would you always connect to the same Asian Realm server or does it assign differently each time?
I know there is also a korea.battle.net. But I believe it just redirects to asia.battle.net.
Quote from: Yegg on November 23, 2005, 12:03 PM
Quote from: LivedKrad.fe on November 23, 2005, 11:57 AM
Aren't there like 3 Asia servers though? Would you always connect to the same Asian Realm server or does it assign differently each time?
I know there is also a korea.battle.net. But I believe it just redirects to asia.battle.net.
Well, my point was that if one were to make a function to choose a Realm server instead of receiving them from Battle.net, how would one determine which is the best if there is more than one? Sure the function obviously works for USEast, but what of the Asian Realm? I think the Realm server replies with 3 possible choices for Realms when using the SID_QUERYREALM packet.
Quote from: Tass on November 22, 2005, 04:30 PM
why do you get No Battle.net connection detected? your not connected to bncs or mcp?
Que?
Have you sent SID_LOGONREALMEX (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=14) yet?
Quote from: LivedKrad.fe on November 23, 2005, 12:06 PM
Well, my point was that if one were to make a function to choose a Realm server instead of receiving them from Battle.net, how would one determine which is the best if there is more than one? Sure the function obviously works for USEast, but what of the Asian Realm? I think the Realm server replies with 3 possible choices for Realms when using the SID_QUERYREALM packet.
It does.
ASIA1: 222.233.16.239
ASIA2: 222.233.48.9
ASIA3: 222.233.67.9
And from what i know, its just user prefance. Untill I select otherwise it ALWAYS logins to Asia1. No matter what account I use.
And for Tass, Heres the Full protocol from my notes. Learn it, Love it, Live it.
C->S BNCS: Protocol Byte (0x01)
C->S BNCS: (0x50) SID_AUTH_INFO (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=2)
S->C BNCS: (0x25) SID_PING (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=6)
C->S BNCS: (0x25) SID_PING (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=191)
S->C BNCS: (0x50) SID_AUTH_INFO (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=3)
C->S BNCS: (0x51) SID_AUTH_CHECK (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=4)
S->C BNCS: (0x51) SID_AUTH_CHECK (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=27)
C->S BNCS: (0x33) SID_GETFILETIME (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=40) (Optional: bnserver-D2DV.ini)
S->C BNCS: (0x33) SID_GETFILETIME (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=41) (Optional)
C->S BNCS: (0x3A) SID_LOGONRESPONSE (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=367)
S->C BNCS: (0x3A) SID_LOGONRESPONSE (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=366)
C->S BNCS: (0x40) SID_QUERYREALMS2 (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=395)
S->C BNCS: (0x40) SID_QUERYREALMS2 (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=394)
C->S BNCS: (0x3E) SID_LOGONREALMX (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=14)
S->C BNCS: (0x3E) SID_LOGONREALMX (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=15)
C->S MCP: Protocol Byte (0x01)
C->S MCP: (0x01) MCP_STARTUP (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=93)
S->C MCP: (0x01) MCP_STARTUP (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=94)
C->S MCP: (0x19) MCP_CHARLIST2 (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=409)
S->C MCP: (0x19) MCP_CHARLIST2 (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=408)
C->S MCP: (0x07) MCP_CHARLOGON (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=97)
S->C MCP: (0x07) MCP_CHARLOGON (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=98)
C->S MCP: (0x12) MCP_MOTD (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=155) (Optional)
C->S BNCS: (0x0B) SID_GETCHANNELLIST (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=33) (Optional)
C->S BNCS: (0x0A) SID_ENTERCHAT (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=32)
S->C MCP: (0x12) MCP_MOTD (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=154) (Optional)
S->C BNCS: (0x0B) SID_GETCHANNELLIST (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=46) (Optional)
S->C BNCS: (0x0A) SID_ENTERCHAT (http://bnetdocs.valhallalegends.com/content.php?Section=m&Code=38)
~-~(HDX)~-~
[4:29:14 PM] Connecting..
[4:29:14 PM] Connected.
[4:29:15 PM] Checking version...
[4:29:15 PM] Passed Key/Version Check!
[4:29:15 PM] Sending login information...
[4:29:16 PM] Battle.net login accepted!
[4:29:16 PM] MCP: Connecting to 63.240.202.148...
[4:29:16 PM] MCP: Connected, sending startup!
[4:29:16 PM] MCP: No Battle.net connection detected
I keep getting no battle.net connection detected here's my code...
Private Sub Parse0x3A(Data As String)
Select Case PBuffer.GetDWORD(Mid$(Data, 5, 4))
Case &H0 ' Login Accecpted
AddC vbGreen, "Battle.net login accepted!"
With PBuffer
.InsertNonNTString "tenb"
.SendPacket &H14
End With
If frmRegister.Visible <> True Then: SendABCs
Case &H1 ' Account Doesn't Exist
SendAccountCreation BNCS.Username, BNCS.Password
Case &H2 ' Wrong Password
AddC vbRed, "Invalid Password.": frmMain.sckBNCS_Close
End Select
End Sub
Public Sub SendABCs()
If LCase(GetStuff("Main", "RealmLogin")) = "t" Then
PBuffer.SendPacket &H40
Else
With PBuffer
.InsertNTString BNCS.Username
.InsertBYTE &H0
.SendPacket &HA
.InsertDWORD &H2
.InsertNTString BNCS.HomeChannel
.SendPacket &HC
End With
End If
End Sub
Private Sub Parse0x40(Data As String)
MCP.Realm = Mid(Data, 17, 6)
Dim RealmHash As String
RealmHash = String(5 * 4, vbNullChar)
A2 RealmHash, ServerToken
With PBuffer
.InsertDWORD &H1
.InsertNonNTString RealmHash
.InsertNTString MCP.Realm
.SendPacket &H3E
End With
End Sub
Private Sub Parse0x3E(Data As String)
AddC vbrealm, Len(Data)
MCP.Chunk1 = Mid$(Data, 5, 16)
MCP.Ip = Mid$(Data, 21, 4)
MCP.Ip = PBuffer.ConvertToServer(MCP.Ip)
MCP.Port = Mid$(Data, 25, 4)
MCP.Chunk2 = Mid$(Data, 21, 48)
MCP.Unique = Mid(Data, 77, Len(Data) - 79)
frmMain.sckMCP.Connect MCP.Ip, 6112
AddC vbrealm, "MCP: Connecting to " & MCP.Ip & "..."
End Sub
[MF edit: added code tags]
Well it looks like you're not checking your realm logon status inside Parse0x3e, you're just kind of assuming it's okay.
I fixed this but I do not see how it would give me no connection to bnet error message in 0x01?
Your port parsing is incorrect... it's a DWORD not a string as you are assuming in your code. However, you do not need to parse the port, since it will always be 6112, so you can just assume it being that.
I'm not even using the port I'v pharsed incorrectly. Still, I have this problem, any suggestions anyone?
In that case there is an error in your ConvertToServer() function. Perhaps show us that.
Public Function ConvertToServer(Data As String) As String
ConvertToServer = CLng("&H" & ToHex(Mid$(Data, 1, 1))) & "." & CLng("&H" & ToHex(Mid$(Data, 2, 1))) & "." & CLng("&H" & ToHex(Mid$(Data, 3, 1))) & "." & CLng("&H" & ToHex(Mid$(Data, 4, 1)))
End Function
Quote from: Tass on November 25, 2005, 05:39 PM
Public Function ConvertToServer(Data As String) As String
ConvertToServer = CLng("&H" & ToHex(Mid$(Data, 1, 1))) & "." & CLng("&H" & ToHex(Mid$(Data, 2, 1))) & "." & CLng("&H" & ToHex(Mid$(Data, 3, 1))) & "." & CLng("&H" & ToHex(Mid$(Data, 4, 1)))
End Function
wtf. use inet_addr or inet_ntoa.. Or whatever that other thing is that Kp will say to use
inet_addr? inet_ntoa?
Quote from: UserLoser on November 25, 2005, 05:41 PMwtf. use inet_addr or inet_ntoa.. Or whatever that other thing is that Kp will say to use
inet_pton(3) / inet_ntop(3)
I'm tired of explaining why the other options are inferior. Search for prior posts by me with those words if you want to see how wrong you are in continuing to use inet_addr.
everything I have found about inet_pton is in C++...
inet_ functions are besides the point though, in your previous posts it looks like you do get connected to MCP but then the server closes connection.. perhaps you are sending your MCP 0x01 incorrectly?
yes, I had my parse 0x3E wrong so when I send the data from 0x3e in packet 0x01 mCp. it was wrong so it woulden't let me connect >.<
Anyways about this inet stuff where can I find some info about it on vb6?
Quote from: Tass on November 26, 2005, 11:34 AM
yes, I had my parse 0x3E wrong so when I send the data from 0x3e in packet 0x01 mCp. it was wrong so it woulden't let me connect >.<
Anyways about this inet stuff where can I find some info about it on vb6?
Public Declare Function htons Lib "ws2_32.dll" (ByVal hostshort As Integer) As Integer
Public Declare Function htonl Lib "ws2_32.dll" (ByVal hostlong As Long) As Long
Public Declare Function ntohl Lib "ws2_32.dll" (ByVal netlong As Long) As Long
Public Declare Function ntohs Lib "ws2_32.dll" (ByVal netshort As Integer) As Integer
Or you could do it your self by doing somthing like this:
CopyMemory MCP.Port, ByVal StrReverse(Mid$(Data, 25, 2)), 2
'or
MCP.Port = htons(GetWORD(Mid$(Data, 25, 2)))
And convert it back to a string with somthing like this:
Dim strBuf As String * 2
CopyMemory ByVal strBuf, 6112, 2
strBuf = StrReverse(strBuf)
Also, the realm is probly saying you dont have a active BNCS connection, because of the data chunks are wrong (thats what the problem was when i had that problem)
Hope this helps
Have the flags for each char in 0x17 MCP packet changed because I do not see them inside the packets I'm receiving.
Here's the packet log..
16 63.240.202.148 172.169.118.249 361 Recv
0000 69 01 17 08 00 08 00 00 00 08 00 54 61 73 73 00 i..........Tass.
0010 84 80 3A 01 01 01 01 05 FF 4F 02 02 FF 02 FF F0 ..:......O......
0020 F0 F0 F0 FF FF 09 F0 F0 FF 11 C4 82 FF FF 03 FF ................
0030 FF 00 54 61 73 73 69 6E 61 74 6F 72 00 84 80 3F ..Tassinator...?
0040 02 02 02 02 FF FF 54 02 02 FF 02 25 ED ED ED ED ......T....%....
0050 FF FF FF ED ED FF 17 E8 9A FF FF 03 FF FF 00 54 ...............T
0060 61 73 73 49 73 4E 6F 6F 62 00 84 80 FF FF FF FF assIsNoob.......
0070 FF FF FF FF FF FF FF 05 FF FF FF FF FF FF FF FF ................
0080 FF FF FF 01 E1 80 80 80 03 FF FF 00 52 75 69 73 ............Ruis
0090 6B 6F 00 84 80 3A 03 02 02 02 0E FF 54 02 02 FF ko...:......T...
00A0 05 FF FF FF FF FF FF FF FF FF FF FF 0B C8 80 FF ................
00B0 FF 03 FF FF 00 57 54 46 4D 61 74 65 00 84 80 FF .....WTFMate....
00C0 FF FF FF FF FF FF FF FF FF FF 02 FF FF FF FF FF ................
00D0 FF FF FF FF FF FF 01 C1 80 80 80 03 FF FF 00 54 ...............T
00E0 61 73 73 49 73 44 65 61 64 00 84 80 FF FF FF FF assIsDead.......
00F0 FF FF FF FF FF FF FF 02 FF FF FF FF FF FF FF FF ................
0100 FF FF FF 01 CC 80 FF FF 03 FF FF 00 4E 6F 6E 4C ............NonL
0110 61 64 54 61 73 73 44 65 61 64 00 84 80 FF FF FF adTassDead......
0120 FF FF FF FF FF FF FF FF 02 FF FF FF FF FF FF FF ................
0130 FF FF FF FF 01 8C 80 FF FF FF FF FF 00 54 61 73 .............Tas
0140 73 4C 61 64 64 61 00 84 80 FF FF FF FF FF FF FF sLadda..........
0150 FF FF FF FF 05 FF FF FF FF FF FF FF FF FF FF FF ................
0160 01 E1 80 80 80 03 FF FF 00 .........
.........
These are the flags that are posted on bnetdocs
'1. No Flags: 01 81 80 80 80
'2. Expansion: 01 A1 80 80 80
'3. Hardcore: 01 85 80 80 80
'4. Ladder: 01 C1 80 80 80 01
'5. Expansion & Ladder: 01 E1 80 80 80 01
'6. Hardcore & Expansion: 01 A5 80 80 80
'7. Hardcore & Ladder: 01 C5 80 80 80 01
'8. HardCore & Ladder & EXP: 01 E5 80 80 80 01
Quote from: Tass on November 26, 2005, 04:53 PMHave the flags for each char in 0x17 MCP packet changed because I do not see them inside the packets I'm receiving.
No, they were changed for another reason.
Do you have a new list somewhere or know of one that I could look at?
BTW: anyone know why wpe pro can't find diablo II in the targets.. I can't packet log d2 now to find out some stuff...