Valhalla Legends Archive

Programming => Battle.net Bot Development => Topic started by: CMallette on April 12, 2004, 12:41 PM

Title: Regarding BNet Chat Bots..
Post by: CMallette on April 12, 2004, 12:41 PM
After opening a connection to Battle.net and successfully logging in using CHAT, if I try to open a second connection in CHAT, it will disconnect the first connection from Battle.net, but will not close the socket or return any error.

My question is, how could the program know if it was disconnected due to this, if Battle.net doesn't close the socket?
Title: Re:Regarding BNet Chat Bots..
Post by: iago on April 12, 2004, 12:47 PM
Don't connect a second? :P
Title: Re:Regarding BNet Chat Bots..
Post by: AC_Drkan on April 12, 2004, 02:05 PM
yeah thats right because you connect using 1 because of the winsock connection. it connects using 1 of 2 things:
1) hostname
2) ip address
Title: Re:Regarding BNet Chat Bots..
Post by: Eric on April 12, 2004, 02:12 PM
You can only have one chat connection per IP; trying to connect a second chat bot would result in Battle.net closing one of the two connections.
If you wish to know what event is triggered when this occurs, we need to know what language you're using.
Title: Re:Regarding BNet Chat Bots..
Post by: CMallette on April 12, 2004, 04:10 PM
Visual Basics..

It ain't triggering _Error or _Close on the Winsock.

In addition, the state of the winsock of the bot that got disconnected from Battle.net is still sckConnected. It's like if Battle.net disconnects the bot but doesn't close the connection with the person.
Title: Re:Regarding BNet Chat Bots..
Post by: iago on April 12, 2004, 04:15 PM
it's like unplugging your NIC - there's no notification.  Try sending SID_NULL (or some equivolant, like /time) every minute or so to check.
Title: Re:Regarding BNet Chat Bots..
Post by: CMallette on April 12, 2004, 05:44 PM
Would you happen to know the amount of data you must send to Battle.net before getting disconnected with "Flooded" error and is it different for CHAT and SEXP?

Basically I could do something like:

public function GotUnplugged() as boolean
on error goto hell
   socket.sendData chr(0)
   GotUnplugged = false
   exit function
hell:
   GotUnplugged = true
end function


Would that chr(0) be counted in the amount of data I sent for the anti-flood thing over at Battle.net?
Title: Re:Regarding BNet Chat Bots..
Post by: iago on April 12, 2004, 06:04 PM
Quote from: CMallette on April 12, 2004, 05:44 PM
Would you happen to know the amount of data you must send to Battle.net before getting disconnected with "Flooded" error and is it different for CHAT and SEXP?

Basically I could do something like:

public function GotUnplugged() as boolean
on error goto hell
   socket.sendData chr(0)
   GotUnplugged = false
   exit function
hell:
   GotUnplugged = true
end function


Would that chr(0) be counted in the amount of data I sent for the anti-flood thing over at Battle.net?

Look it up, it's been discussed many times.

And yes, the char(0) is part of the packet, so I would imagine it counts.
Title: Re:Regarding BNet Chat Bots..
Post by: MyndFyre on April 12, 2004, 08:38 PM
Quote from: CMallette on April 12, 2004, 04:10 PM
Visual Basics..

Oooh -- be careful when saying "Visual Basics" around here -- there are some extremely zealous people who will eat you if you don't remember that it's only singular, not plural.

Try it out a few times...

"Visual Basic"
"Visual Basic"
"Visual Basic"
"I am a newb", er... "Visual Basic"
Title: Re:Regarding BNet Chat Bots..
Post by: iago on April 12, 2004, 10:12 PM
Quote from: Myndfyre on April 12, 2004, 08:38 PM
Quote from: CMallette on April 12, 2004, 04:10 PM
Visual Basics..

Oooh -- be careful when saying "Visual Basics" around here -- there are some extremely zealous people who will eat you if you don't remember that it's only singular, not plural.

Try it out a few times...

"Visual Basic"
"Visual Basic"
"Visual Basic"
"I am a newb", er... "Visual Basic"

That was cuphead, but he is now otherwise disposed so that's the end of it.
Title: Re:Regarding BNet Chat Bots..
Post by: Stealth on April 13, 2004, 12:20 AM
Quote from: CMallette on April 12, 2004, 05:44 PM
Would you happen to know the amount of data you must send to Battle.net before getting disconnected with "Flooded" error and is it different for CHAT and SEXP?

Basically I could do something like:

public function GotUnplugged() as boolean
on error goto hell
   socket.sendData chr(0)
   GotUnplugged = false
   exit function
hell:
   GotUnplugged = true
end function


Would that chr(0) be counted in the amount of data I sent for the anti-flood thing over at Battle.net?

Yes, it would; under CHAT the only messages you can send are, well, chat messages. There is no binary protocol layer as exists with the game clients, so all messages count against your flood protection limit. Sending chr(0), however, will most likely get you disconnected immediately -- sending something more friendly, like /whoami or /time, is a better way to check the connection status.

Nice line label, by the way. :)
Title: Re:Regarding BNet Chat Bots..
Post by: tA-Kane on April 13, 2004, 04:49 PM
Quote from: Stealth on April 13, 2004, 12:20 AMNice line label, by the way. :)

This is such a good word, coming from someone new to programming.
Quote from: CMallette on April 12, 2004, 05:44 PMon error goto hell