• Welcome to Valhalla Legends Archive.
 

Help for Lots of Sockets

Started by ObsidianWolf, January 22, 2004, 01:31 PM

Previous topic - Next topic

ObsidianWolf

I am making a bot that can handle using multiple connections to bnet and such.  heres what I use to keep open only what I need.  Figured i would share incase other needed help.
Connection is a Type I use to hold which sockets are connected to what server on bnet.  

Public Function CreateNew() As Integer
For i = 1 To UBound(Connections)
   If Connections(i).Closed = True Then             '## Checks if theres any closed Socket
       CreateNew = i                           '## Gets the First One to use.
       Exit Function                           '## Saves Alot of Socket :o)
   End If
Next i
ReDim Preserve Connections(0 To UBound(Connections) + 1)  '## Create 1 more if no Free Socket
CreateNew = UBound(Connections)                      '## Set the Index to return
Load frmMain.socket(CreateNew)                  '## Create another Socket to use