• Welcome to Valhalla Legends Archive.
 

Auto-Reconnect on Disconnection

Started by FiReGoD, April 08, 2003, 05:42 AM

Previous topic - Next topic

FiReGoD

i was wondering how you can do a auto-reconnect function, i was thinking a timer and every so often seconds it checks to see if you are connected, but that would just waste memory,

i am using visual basics, and running csb(cleanslatebot).

haZe

On the BnetDisconnected event, call csb.connect I believe.

FiReGoD

i know but what if you disconnect from the mnuDisconnect() function

then when you do that it will just reconnect

Yoni

Have a boolean variable like "ShouldBeConnected".
This variable will be True when the bot should be connected, or False when the bot should be disconnected.

Then, when you disconnect intentionally (i.e. from the mnuDisconnect function):
ShouldBeConnected = False
CSB.Close ' or whatever the function name is

And in the BnetDisconnected event:
If ShouldBeConnected Then CSB.Connect

CupHead

If you're using CleanSlateBot1.Disconnect as part of your mnuDisconnect sub, then reconnecting on disconnect will be fine.  The .Disconnect method intentionally does not raise the BnetDisconnected, RealmDisconnected, and/or BNLSDisconnected events.

Banana fanna fo fanna

I've never heard of visual basics.

Smurfling

This code i am using for VB.Net:

Handles the CleanSlateBot.OCX Event Disconnected:
Private Sub BNET_Disconnected(ByVal sender As Object, ByVal e As System.EventArgs) Handles csb.BnetDisconnected

AddChat(Col.FromKnownColor(Color_Text_Error), "Disconnected from Battle.Net.")
csb.Connect()

End Sub


Handles your mnuDisconnect() Event:
Private Sub mnuDisconnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuDisconnect.Click

If csb.Connected = True Then csb.Disconnect()

End Sub


csb = CleanSlateBot.ocx