Valhalla Legends Forums Archive | Battle.net Bot Development | Handling 2 winsock controls

AuthorMessageTime
bethra
For the logon sequence I'm doing it would go like this:

SEND: BNLS_REQUESTVERSIONBYTE (0x10)
RECV: BNLS_REQUESTVERSIONBYTE (0x10)
SEND: SID_AUTH_INFO (0x50)
RECV: SID_AUTH_INFO (0x50)
SEND: BNLS_CDKEY (0x01)
RECV: BNLS_CDKEY (0x01)
SEND: BNLS_VERSIONCHECK (0x09)
RECV: BNLS_VERSIONCHECK (0x09)
SEND: SID_AUTH_CHECK (0x51)
RECV: SID_AUTH_CHECK (0x51)

I'm using two winsock controls, sckBNLS and sckBNCS and I'm trying to do this logon sequence however I keep getting the run-time error '40006'.

Basically what I'm doing is, everytime I recieve a packet from either control, I then send the next packet of the logon sequence.

I'm guessing that I'm trying to send a packet when one of the winsock controls is not connected yet or it is in some state other than open. So that would mean I would need to wait until the other winsock control is open before I send the packet...

I've tried doing Do statements with the i.e. "sckBNLS.State = 0" thing but I get fatal errors and Visual Basic 6 crashes with a fatal error.

Also, I've also put a statement in the packet buffer class that if the connection isn't open it won't send the packet. The problem with that is the packet will be skipped (will not be sent) and the logon sequence broken...

I could use like public variables to keep track of which state of the logon sequence it is in, but there has to be another way. Or would that be the way you would do it?
August 31, 2004, 9:19 PM
Stealth
You can get around this by strategically using the _Connect() subs.

Here's an example.

(start connection)
[color=#FFFFFF] [5:56:03 PM] [/color][color=#0099CC]BNLS CONNECT[/color]
(BNLS authorization)
[color=#FFFFFF] [5:56:03 PM] [/color][color=#0099CC]BNLS SEND 0x0E
[/color][color=#FFFFFF] [5:56:03 PM] [/color][color=#0099CC]BNLS RECV 0x0E
[/color][color=#FFFFFF] [5:56:03 PM] [/color][color=#0099CC]BNLS SEND 0x0F
[/color][color=#FFFFFF] [5:56:03 PM] [/color][color=#0099CC]BNLS RECV 0x0F[/color]
(receipt of successful BNLS authorization: sckBNCS.Connect)
[color=#FFFFFF] [5:56:03 PM] [/color][color=#0099CC]BNET CONNECT[/color]
(_Connect() event fires, send BNLS 0x10)
[color=#FFFFFF] [5:56:03 PM] [/color][color=#0099CC]BNLS SEND 0x10
[/color][color=#FFFFFF] [5:56:03 PM] [/color][color=#0099CC]BNLS RECV 0x10[/color]
(receipt of BNLS 0x10, send BNCS 0x50)
[color=#FFFFFF] [5:56:03 PM] [/color][color=#0099CC]BNET SEND 0x50
[/color]

In order to receive 0x10, the BNET socket MUST be connected and ready to transfer data because 0x10 won't be sent until that Connect() event fires.

HTH
August 31, 2004, 10:59 PM
bethra
Hmmm why do you need to use the BNLS_AUTHORIZE and BNLS_AUTHORIZEPROOF? I thought they got rid of that so you don't need to use it...

September 1, 2004, 4:49 PM
Kp
[quote author=bethra link=board=17;threadid=8499;start=0#msg78544 date=1094057396]
Hmmm why do you need to use the BNLS_AUTHORIZE and BNLS_AUTHORIZEPROOF? I thought they got rid of that so you don't need to use it...[/quote]

Right. However, you're still permitted to do it, and if you do, then BNLS can count how many times that login has been used. The author can then inquire about that, to determine how popular his client is. If he gets 1 login a day vs. if he gets several thousand a day, etc.
September 2, 2004, 2:23 AM
Stealth
In that case:

[quote author=Stealth link=board=17;threadid=8499;start=0#msg78467 date=1093993184]
(start connection)
[color=#FFFFFF] [5:56:03 PM] [/color][color=#0099CC]BNLS CONNECT[/color]
(receipt of sckBNLS_Connect(): sckBNCS.Connect)
[color=#FFFFFF] [5:56:03 PM] [/color][color=#0099CC]BNET CONNECT[/color]
(_Connect() event fires, send BNLS 0x10)
[color=#FFFFFF] [5:56:03 PM] [/color][color=#0099CC]BNLS SEND 0x10
[/color][color=#FFFFFF] [5:56:03 PM] [/color][color=#0099CC]BNLS RECV 0x10[/color]
(receipt of BNLS 0x10, send BNCS 0x50)
[color=#FFFFFF] [5:56:03 PM] [/color][color=#0099CC]BNET SEND 0x50
[/color]

In order to receive 0x10, the BNET socket MUST be connected and ready to transfer data because 0x10 won't be sent until that Connect() event fires.
[/quote]

Now, the first _Connect() sub triggers the opening of the second socket. The second socket's _Connect() sub triggers the start of the login sequence as you had planned. Same concept -- in order for the packet sequence to begin, the BNCS socket must be connected. In order for the BNCS socket to be connected, the BNLS socket must be connected. At any point along the way you may error out due to availablility of either server and the login sequence will not proceed.
September 2, 2004, 3:27 AM

Search