• Welcome to Valhalla Legends Archive.
 

Handling 2 winsock controls

Started by Sorc.Polgara, August 31, 2004, 04:19 PM

Previous topic - Next topic

Sorc.Polgara

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?

Stealth

#1
You can get around this by strategically using the _Connect() subs.

Here's an example.

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


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
- Stealth
Author of StealthBot

Sorc.Polgara

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...


Kp

Quote from: bethra on September 01, 2004, 11:49 AM
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...

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.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Stealth

In that case:

Quote from: Stealth on August 31, 2004, 05:59 PM
(start connection)
[5:56:03 PM] BNLS CONNECT
(receipt of sckBNLS_Connect(): sckBNCS.Connect)
[5:56:03 PM] BNET CONNECT
(_Connect() event fires, send BNLS 0x10)
[5:56:03 PM] BNLS SEND 0x10
[5:56:03 PM] BNLS RECV 0x10
(receipt of BNLS 0x10, send BNCS 0x50)
[5:56:03 PM] BNET SEND 0x50


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.

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.
- Stealth
Author of StealthBot