Valhalla Legends Forums Archive | Battle.net Bot Development | MCP/0x34/No Connection Detected (Tass Sucks at Topics)

AuthorMessageTime
Tass
why do you get No Battle.net connection detected? your not connected to bncs or mcp?
November 22, 2005, 10:30 PM
UserLoser.
BNCS?  How can MCP tell you if you're not connected to MCP?

???
November 22, 2005, 11:08 PM
Tass
What packets do you need to send before you start sendind packets through MCP?
November 23, 2005, 1:51 AM
Myndfyr
Well, BnetDocs discusses three packets used on the chat server related to realm communications: SID_QUERYREALMS, SID_QUERYREALMS2, and SID_LOGONREALMEX.  If I was interested I might have searched the forum for some information about these packets.
November 23, 2005, 2:10 AM
Tass
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?
November 23, 2005, 2:53 AM
HdxBmx27
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)~-~
November 23, 2005, 3:05 AM
l2k-Shadow
Use 0x40
November 23, 2005, 4:24 AM
Tass
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..
November 23, 2005, 3:24 PM
l2k-Shadow
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.
November 23, 2005, 5:52 PM
LivedKrad
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?
November 23, 2005, 5:57 PM
Yegg
[quote author=LivedKrad.fe link=topic=13332.msg135148#msg135148 date=1132768664]
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]
I know there is also a korea.battle.net. But I believe it just redirects to asia.battle.net.
November 23, 2005, 6:03 PM
LivedKrad
[quote author=Yegg link=topic=13332.msg135151#msg135151 date=1132769000]
[quote author=LivedKrad.fe link=topic=13332.msg135148#msg135148 date=1132768664]
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]
I know there is also a korea.battle.net. But I believe it just redirects to asia.battle.net.
[/quote]

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.
November 23, 2005, 6:06 PM
LivedKrad
[quote author=Tass link=topic=13326.msg135055#msg135055 date=1132698654]
why do you get No Battle.net connection detected? your not connected to bncs or mcp?
[/quote]

Que?
November 23, 2005, 6:07 PM
Myndfyr
Have you sent SID_LOGONREALMEX yet?
November 23, 2005, 6:34 PM
HdxBmx27
[quote author=LivedKrad.fe link=topic=13334.msg135152#msg135152 date=1132769211]
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]
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
S->C BNCS: (0x25) SID_PING
C->S BNCS: (0x25) SID_PING
S->C BNCS: (0x50) SID_AUTH_INFO
C->S BNCS: (0x51) SID_AUTH_CHECK
S->C BNCS: (0x51) SID_AUTH_CHECK
C->S BNCS: (0x33) SID_GETFILETIME (Optional: bnserver-D2DV.ini)
S->C BNCS: (0x33) SID_GETFILETIME (Optional)
C->S BNCS: (0x3A) SID_LOGONRESPONSE
S->C BNCS: (0x3A) SID_LOGONRESPONSE
C->S BNCS: (0x40) SID_QUERYREALMS2
S->C BNCS: (0x40) SID_QUERYREALMS2
C->S BNCS: (0x3E) SID_LOGONREALMX
S->C BNCS: (0x3E) SID_LOGONREALMX
C->S MCP: Protocol Byte (0x01)
C->S MCP: (0x01) MCP_STARTUP
S->C MCP: (0x01) MCP_STARTUP
C->S MCP: (0x19) MCP_CHARLIST2
S->C MCP: (0x19) MCP_CHARLIST2
C->S MCP: (0x07) MCP_CHARLOGON
S->C MCP: (0x07) MCP_CHARLOGON
C->S MCP: (0x12) MCP_MOTD (Optional)
C->S BNCS: (0x0B) SID_GETCHANNELLIST (Optional)
C->S BNCS: (0x0A) SID_ENTERCHAT
S->C MCP: (0x12) MCP_MOTD (Optional)
S->C BNCS: (0x0B) SID_GETCHANNELLIST (Optional)
S->C BNCS: (0x0A) SID_ENTERCHAT
~-~(HDX)~-~

November 23, 2005, 7:21 PM
Tass
[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...

[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
[/code]

[MF edit: added code tags]
November 23, 2005, 9:33 PM
Myndfyr
Well it looks like you're not checking your realm logon status inside Parse0x3e, you're just kind of assuming it's okay.
November 24, 2005, 1:13 AM
Tass
I fixed this but I do not see how it would give me no connection to bnet error message in 0x01?
November 24, 2005, 3:59 PM
l2k-Shadow
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.
November 24, 2005, 5:08 PM
Tass
I'm not even using the port I'v pharsed incorrectly. Still, I have this problem, any suggestions anyone?
November 25, 2005, 3:48 AM
l2k-Shadow
In that case there is an error in your ConvertToServer() function. Perhaps show us that.
November 25, 2005, 5:11 PM
Tass
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
November 25, 2005, 11:39 PM
UserLoser.
[quote author=Tass link=topic=13334.msg135324#msg135324 date=1132961980]
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]

wtf.  use inet_addr or inet_ntoa.. Or whatever that other thing is that Kp will say to use
November 25, 2005, 11:41 PM
Tass
inet_addr? inet_ntoa?
November 25, 2005, 11:48 PM
Kp
[quote author=UserLoser link=topic=13334.msg135325#msg135325 date=1132962068]wtf.  use inet_addr or inet_ntoa.. Or whatever that other thing is that Kp will say to use[/quote]

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.
November 26, 2005, 12:42 AM
Tass
everything I have found about inet_pton is in C++...
November 26, 2005, 2:30 AM
l2k-Shadow
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?
November 26, 2005, 6:25 AM
Tass
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?
November 26, 2005, 5:34 PM
Ringo
[quote author=Tass link=topic=13334.msg135387#msg135387 date=1133026471]
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]
[code]
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

[/code]
Or you could do it your self by doing somthing like this:
[code]
CopyMemory MCP.Port, ByVal StrReverse(Mid$(Data, 25, 2)), 2
'or
MCP.Port = htons(GetWORD(Mid$(Data, 25, 2)))
[/code]
And convert it back to a string with somthing like this:
[code]
Dim strBuf As String * 2
CopyMemory ByVal strBuf, 6112, 2
strBuf = StrReverse(strBuf)
[/code]

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
November 26, 2005, 6:07 PM
Tass
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
November 26, 2005, 10:53 PM
Kp
[quote author=Tass link=topic=13334.msg135406#msg135406 date=1133045619]Have the flags for each char in 0x17 MCP packet changed because I do not see them inside the packets I'm receiving.[/quote]

No, they were changed for another reason.
November 26, 2005, 11:25 PM
Tass
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...
November 26, 2005, 11:43 PM

Search