• Welcome to Valhalla Legends Archive.
 

More winsock connections.

Started by REiGN, March 24, 2003, 04:58 PM

Previous topic - Next topic

REiGN

Ok say when I get disconnected from battle.net. How would I make more winsocks trying to connect, since im only using one I get around 1 reconnect per second, Im thinking more like 6 per second. This is how it looks right now.


Private Sub Winsock_Close()
   AddChat "Server closed connection" & vbCrLf, vbRed
   Battlenet.Disconnect Winsock
   Winsock.Connect
End Sub

n00blar

I'm not understanding you to well but let me _try_ to help you...


Private Sub SocketName_Close()
   SocketName.Close
   SocketName.Connect 'assuming all properties required set
End Sub

REiGN

Like I would want 5 winsocks trying to connect to battle.net at the same time.

n00blar

I am not quite sure *why* you would want to do that but there are a couple ways you could do that

1: Add five winsock controls to the form

Private Sub Form_Load()
   'set properties
   SocketName1.Connect
   SocketName2.Connect
   SocketName3.Connect
   SocketName4.Connect
   SocketName5.Connect
End Sub


2: Add one winsock control, goto ites properties, and set an index value

Private Sub Form_Load()
    Dim i as Integer
    For i = (Index Value you set) + 1 to (Index Value you set) + 4
        Load SocketName(i)
        'set properties
        SocketName(i).Connect
    Next i
End Sub

REiGN

So for the frist one would it look like:
Private Sub Winsock_Close()
   AddChat "Server closed connection" & vbCrLf, vbRed
   Battlenet.Disconnect Winsock
   Winsock1.Connect
   Winsock2.Connect
   Winsock3.Connect
   Winsock4.Connect
End Sub








Quote from: n00blar link=board=17;threadid=809;start=0#msg6395
date=1048629452

I am not quite sure *why* you would want to do that but there are a couple ways you could do that

1: Add five winsock controls to the form

Private Sub Form_Load()
   'set properties
   SocketName1.Connect
   SocketName2.Connect
   SocketName3.Connect
   SocketName4.Connect
   SocketName5.Connect
End Sub


2: Add one winsock control, goto ites properties, and set an index value

Private Sub Form_Load()
    Dim i as Integer
    For i = (Index Value you set) + 1 to (Index Value you set) + 4
        Load SocketName(i)
        'set properties
        SocketName(i).Connect
    Next i
End Sub

Quote

z0rg

y0 REIGN this is {EwR}ZeRG^KoG .. IM me.. ill help u out...    

AIM: eheads15

Atom

This is a terrible idea. If your having problems reconnecting fast adding more sockets is gonna add to the problem. Not to mention you will have 6 winsocks that will end up connecting. It will probably also end up with an ip ban. I really wouldnt reccomend that.
I am back! aINC is dead, ThinkTank PRO is alive.
VB, JAVA, ASM, C, its all yummy to me.

Banana fanna fo fanna

Reign: what exactly are you trying to do?

Sevatox

#8
Hes trying to make a massload, super reconnect bot for xgn (zorm's warrnet server) :\

EDIT: forgot to mention, you can't get ipbanned unless zorm, avenger, or slash  ibpan you

Skywing

#9
Quote from: St0rm.iD on March 27, 2003, 06:34 PM
Reign: what exactly are you trying to do?
I'll take a stab in the dark and guess he's trying to reestablish a lost connection faster when the remote host has gone down for a reboot.  For whatever reason, I'm guessing he doesn't want to wait around for the TCP SYN messages to be timed out and presumed lost by the OS before it returns failure for a connect event.

A better solution might be to offset each connect attempt by say 250ms, and if all connect attempts are in progress after 250ms more rolls around, cancel the oldest request.  Naturally, this will make it impossible to connect if your latency to the server is around 1500ms or higher, but I'm also guessing the author isn't too concerned about that.