• Welcome to Valhalla Legends Archive.
 

Creating D2 Game

Started by OnlyMeat, July 11, 2004, 01:07 AM

Previous topic - Next topic

OnlyMeat

iv been having problems trying to create a d2 game, specifically the problem occurs at the end of this sequence i wrote based on analysis of the real clients packets:-

(1) C-->S  0x03 (Realm)
(2) S-->C  0x03 (Realm)
(3) C-->S  0x04 (Realm)
(4) C-->S  0x1c  (Chat)
(5) S-->C  0x04 (Realm) - This contains the IP address of the D2 game server
(6) C-->S 0x22 (Chat) - Notify
(7) C-->S 0x10 (Chat) - LeaveChat
(8) Shutdown realm socket - (Real client appears to do this not sure why??)
(9) Connect to the D2 Game Server - (This is were the problem occurs the socket returns an error specifying that the server actively refused the connnection, the ip address seems ok that it's passing me i.e it's in the bnet servers range and i can ping it and get response and im not ip banned.)

I am a little puzzled by this to say the least i have checked and rechecked a number of times the procedure that the real client appears to use but no luck.

I dont know if any of you guys has done maybe some work on this procedure and could shed some light on the details and//or if im doing something wrong, btw before you ask i tried not disconnecting the realm before connecting to the D2GS and other combinations.

Also im assuming that the D2GS is tcp/ip and has a fixed port of 0xfa0.

Soul Taker

Try sending 0x13 to the realm before leaving chat.  The packet contains no data.

OnlyMeat

Quote from: Soul Taker on July 11, 2004, 10:57 AM
Try sending 0x13 to the realm before leaving chat.  The packet contains no data.

Ok i tried sending 0x13 to the realm just before sending 0x10 (leaving chat) but it still refuses the connection :(

The thing is it sends the 0x04 response with the D2GS IP so i must be doing that part right so i cant understand why it's refusing the connection.

Anymore ideas?

dxoigmn

#3
Post a packet log of the connection (relevant packets) along with the IP address and port of the D2GS you are connecting to.

OnlyMeat

Quote from: dxoigmn on July 11, 2004, 02:34 PM
Post a packet log of the connection (relevant packets) along with the IP address and port of the D2GS you are connecting to.

Game Name: hbrbkav
Password:    1

Packet Log:-


SEND 83.100.132.198 ----> 213.248.106.208 | Realm 0x03 (Create Game)
17 00 03 02 00 00 00 00 00 01 FF 08 68 62 72 62 6B 61 76 00 31 00 00

RECV 83.100.132.198 <---- 213.248.106.208 | Realm 0x03 (Create Game)
0D 00 03 02 00 41 03 00 00 00 00 00 00

SEND 83.100.132.198 ----> 213.248.106.208 | Realm 0x04 (Join Game)
0F 00 04 CB 00 68 62 72 62 6B 61 76 00 31 00

SEND 83.100.132.198 ----> 213.248.106.202 | Chat 0x1c (Create Game)
FF 1C 23 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 68 62 72 62 6B 61 76 00 31 00 00

RECV 83.100.132.198 <---- 213.248.106.208 | Realm 0x04 (Contains D2GS IP: 213.248.106.92, Use Fixed Port 0xfa0)
15 00 04 CB 00 41 03 00 00 D5 F8 6A 5C 3C 34 EB 0F 00 00 00 00

SEND 83.100.132.198 ----> 213.248.106.202 | Chat 0x22 (Notify)
FF 22 16 00 50 58 32 44 0A 00 00 00 68 62 72 62 6B 61 76 00 31 00

SEND 83.100.132.198 ----> 213.248.106.208 | Realm 0x13 (**Soul Taker**)
03 00 13

SEND 83.100.132.198 ----> 213.248.106.202 | Chat 0x10 (Leave Chat)
FF 10 04 00


At the end of this sequence I shutdown the realm socket and attempt to connect to the D2GS server 213.248.106.92
using the fixed port 0xfa0, this then fails and returns a socket error after about 8 seconds specifying that "the target machine actively refused the connection".

Here is my in program log:-

Connected to europe.battle.net
Connecting to realm
Joining realm: europe
Logging in character: xxxx
Joining channel: Diablo II Europe-GBR-1
Welcome to Battle.net!
This server is hosted by Telia.
There are currently 86040 users playing 57453 games of Diablo II Lord of Destruction, and 212259 users playing 80121 games on Battle.net.
Last logon: Mon Jul 12  1:53 PM
Joining channel: op xxx
Creating game: hbrbkav...
Joining game server: 213.248.106.92 on Port: 0xfa0
Socket Error: No connection could be made because the target machine actively refused it.

Disconnected from europe.battle.net

PaiD

well I almost have the same problem. When I connect to d2gs I cant get into the game due to me not sendin a packet I need to send to offically get into it. I do want to know why you disconnect the mcp socket

dxoigmn

Quote from: OnlyMeat on July 12, 2004, 02:06 PM
Quote from: dxoigmn on July 11, 2004, 02:34 PM
Post a packet log of the connection (relevant packets) along with the IP address and port of the D2GS you are connecting to.

Game Name: hbrbkav
Password:    1

Packet Log:-


SEND 83.100.132.198 ----> 213.248.106.208 | Realm 0x03 (Create Game)
17 00 03 02 00 00 00 00 00 01 FF 08 68 62 72 62 6B 61 76 00 31 00 00

RECV 83.100.132.198 <---- 213.248.106.208 | Realm 0x03 (Create Game)
0D 00 03 02 00 41 03 00 00 00 00 00 00

SEND 83.100.132.198 ----> 213.248.106.208 | Realm 0x04 (Join Game)
0F 00 04 CB 00 68 62 72 62 6B 61 76 00 31 00

SEND 83.100.132.198 ----> 213.248.106.202 | Chat 0x1c (Create Game)
FF 1C 23 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 68 62 72 62 6B 61 76 00 31 00 00

RECV 83.100.132.198 <---- 213.248.106.208 | Realm 0x04 (Contains D2GS IP: 213.248.106.92, Use Fixed Port 0xfa0)
15 00 04 CB 00 41 03 00 00 D5 F8 6A 5C 3C 34 EB 0F 00 00 00 00

SEND 83.100.132.198 ----> 213.248.106.202 | Chat 0x22 (Notify)
FF 22 16 00 50 58 32 44 0A 00 00 00 68 62 72 62 6B 61 76 00 31 00

SEND 83.100.132.198 ----> 213.248.106.208 | Realm 0x13 (**Soul Taker**)
03 00 13

SEND 83.100.132.198 ----> 213.248.106.202 | Chat 0x10 (Leave Chat)
FF 10 04 00


At the end of this sequence I shutdown the realm socket and attempt to connect to the D2GS server 213.248.106.92
using the fixed port 0xfa0, this then fails and returns a socket error after about 8 seconds specifying that "the target machine actively refused the connection".

Here is my in program log:-

Connected to europe.battle.net
Connecting to realm
Joining realm: europe
Logging in character: xxxx
Joining channel: Diablo II Europe-GBR-1
Welcome to Battle.net!
This server is hosted by Telia.
There are currently 86040 users playing 57453 games of Diablo II Lord of Destruction, and 212259 users playing 80121 games on Battle.net.
Last logon: Mon Jul 12  1:53 PM
Joining channel: op xxx
Creating game: hbrbkav...
Joining game server: 213.248.106.92 on Port: 0xfa0
Socket Error: No connection could be made because the target machine actively refused it.

Disconnected from europe.battle.net


Quote
SEND 83.100.132.198 ----> 213.248.106.208 | Realm 0x13 (**Soul Taker**)
03 00 13

0x13 tells the server to cancel the game IIRC.  Don't send this and you should be fine.

OnlyMeat

hmm iv been told to try 0x13 to fix the problem originally, I could do with some consistant answers or ideas please.

I will say now sending 0x13 does not make any difference i still get the same socket error.

Surely someone must have done this procedure before i mean it's not that complicated except for the fact that the D2GS rejects the connection.

The reason i shutdown the realm socket is that if you watch the active connections the real client maintains once it creates a game it appears to close the realm connection and open a new one to the D2GS at almost the same time, of course i cant be sure of this but it certainly looks that way from my analysis.

dxoigmn

Quote from: OnlyMeat on July 12, 2004, 04:37 PM
hmm iv been told to try 0x13 to fix the problem originally, I could do with some consistant answers or ideas please.

I will say now sending 0x13 does not make any difference i still get the same socket error.

Surely someone must have done this procedure before i mean it's not that complicated except for the fact that the D2GS rejects the connection.

The reason i shutdown the realm socket is that if you watch the active connections the real client maintains once it creates a game it appears to close the realm connection and open a new one to the D2GS at almost the same time, of course i cant be sure of this but it certainly looks that way from my analysis.

Try leaving the connection to the MCP (realm) open.

OnlyMeat

Quote from: dxoigmn on July 12, 2004, 04:55 PM
Quote from: OnlyMeat on July 12, 2004, 04:37 PM
hmm iv been told to try 0x13 to fix the problem originally, I could do with some consistant answers or ideas please.

I will say now sending 0x13 does not make any difference i still get the same socket error.

Surely someone must have done this procedure before i mean it's not that complicated except for the fact that the D2GS rejects the connection.

The reason i shutdown the realm socket is that if you watch the active connections the real client maintains once it creates a game it appears to close the realm connection and open a new one to the D2GS at almost the same time, of course i cant be sure of this but it certainly looks that way from my analysis.

Try leaving the connection to the MCP (realm) open.

Ye i tried that :(

Soul Taker

Quote from: dxoigmn on July 12, 2004, 03:00 PM
0x13 tells the server to cancel the game IIRC.  Don't send this and you should be fine.
No.  My client, and real D2 clients, send 0x13 after recieving 0x04 and before connecting to the game server.

dxoigmn

Quote from: Soul Taker on July 12, 2004, 05:10 PM
Quote from: dxoigmn on July 12, 2004, 03:00 PM
0x13 tells the server to cancel the game IIRC.  Don't send this and you should be fine.
No.  My client, and real D2 clients, send 0x13 after recieving 0x04 and before connecting to the game server.

Hmm, it's been a while since I've done anything relating to creating games in D2.

MyndFyre

Quote from: dxoigmn on July 12, 2004, 05:36 PM
Hmm, it's been a while since I've done anything relating to creating games in D2.
Yay for pointlessly being unhelpful...  
* Myndfyre sighs

Quote from: OnlyMeat on July 12, 2004, 04:37 PM
The reason i shutdown the realm socket is that if you watch the active connections the real client maintains once it creates a game it appears to close the realm connection and open a new one to the D2GS at almost the same time, of course i cant be sure of this but it certainly looks that way from my analysis.
What makes you think so?  I've never actually done this, but reading this conjecture got me thinking.  If Windows is closing a socket and opening a new one to the D2GS, then it seems to me that the port numbers on your side would be different.  Honestly, that's the only thing I could think of (aside from differing SYN/ACK sequence IDs, I guess) that would tip me off to it being a different socket.

Hope that helps.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

dxoigmn

Quote from: Myndfyre on July 12, 2004, 05:46 PM
Quote from: dxoigmn on July 12, 2004, 05:36 PM
Hmm, it's been a while since I've done anything relating to creating games in D2.
Yay for pointlessly being unhelpful...  
* Myndfyre sighs

Please enlighten us with your knowledge of the protocol.

OnlyMeat

Seems no one on here knows how to do it//or wants to share their knowledge so ill try and hunt down some c++ source for it instead.