Valhalla Legends Forums Archive | Battle.net Bot Development | Staying Connected

AuthorMessageTime
gorshing
I am going to develop a bot using C++ (MS 6.0) I have some source code from a VB bot that I am going to go off of.

But the main problem with the VB bot is that it loses it's connection frequently. I would like to be able to stay connected ... is there something that I could send battle.net to let it know that I am still alive?

I will use WSAAsyncSelect (I believe that is correct) for FD_READ, FD_ACCEPT, and FD_CLOSE ... so when I get disconnected I will connect again ... but I would like to try and prevent, as much as possible, getting disconnected.

Any ideas, or older posts that I have missed?

Thanks for any help,
June 27, 2003, 10:36 PM
Camel
Send an 0x0 packet (no data, just FF 00 04 00) every once in a while. At the very least, send one back whenever battle.net sends you one.
June 27, 2003, 10:49 PM
iago
every 60 seconds is ideal.

One way to do this in c++ is to have a timer thread, but that's a little nasty (you have to do some thread synchronization). Or in your main loop you can check if the current time in seconds is divisible by 60 and if it is send out that packet.
June 27, 2003, 11:28 PM
Camel
Couldn't one just use select() and have it give up after 60 seconds?
June 28, 2003, 1:12 AM
Brolly
Or you can use SetTimer() and handle WM_TIMER.
June 30, 2003, 2:07 AM
Camel
[quote author=Brolly link=board=17;threadid=1716;start=0#msg13243 date=1056938821]
Or you can use SetTimer() and handle WM_TIMER.
[/quote]

Would that be more simple?
June 30, 2003, 4:06 AM
Brolly
Yes. Every X seconds, a WM_TIMER message will be sent. You might not be able to do this in VB, however.
June 30, 2003, 3:48 PM
DarkMinion
You can use timers in VB, it's just different.
June 30, 2003, 5:50 PM
Camel
[quote author=DarkMinion link=board=17;threadid=1716;start=0#msg13325 date=1056995433]You can use timers in VB, it's just different.[/quote]
Well, basicly it's just a CallBack function (which is a paint to debug as the entire VB process will be terminated if the callback function fails to return). VB timer objects are rather useful when efficiency is not the goal.
June 30, 2003, 11:38 PM
DarkMinion
Yes, I went through that particular hang once when I used VB.
July 1, 2003, 12:04 AM
gorshing
Thanks for all the replies ... that's what I figured for a binary bot.

My apologies for not specifing that I am working with a chat bot.

Sorry once again,
July 1, 2003, 12:29 PM

Search