Valhalla Legends Forums Archive | Battle.net Bot Development | Help for Lots of Sockets

AuthorMessageTime
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.
[code]
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
[/code]
January 22, 2004, 7:31 PM

Search