winsock help please (SOLVED WITH THANKS)
Hi all, im trying to get this wonsock fuction to work.
I have another program which connects to this program via winsock.
I have placed a Winsock Object on the form called sckMain and gave it a index of Zero to make it a control array.
Im trying to impliment this from web sites that i have been reading. This part of the program check though a array called bolArray ( a boolean array) which im runnig along side the sckMain array. It check to see if the value ios true (user logged onto that sckMain array) and if not loops around untill it finds a array that is free or false.
Then it assignes that user that sckMain array number. This is get multiple users being able to log into the main server porgam.
Im new to Winsocsk and im not sure my logic is sound. This isnt working im getting a OBJECT requierd at Load Winsock(Winsock.i) I tried changeing the Winsock to the name of my winsock array sckMain but that didnt work. Can anyone shine some light ont his for me please?
VB Code:
Private Sub sckMain_ConnectionRequest(Index As Integer, ByVal RequestID As Long)
For i = 1 To UBound(bolArray)
If bolArray(i) = False Then
' load a new winsock
Load Winsock(Winsock.i)
' accept the incoming connection on our new control
Winsock(Winsock.i).Accept RequestID
bolArray(i) = True
txtMessageDisp.Text = txtMessageDisp.Text & vbNewLine & "SYSTEM: Accepted a New Connection on Winsock " & i
Exit Sub
End If
Next i
' load a new winsock
Load Winsock(Winsock.UBound + 1)
' accept the incoming connection on our new control
Winsock(Winsock.UBound + 1).Accept RequestID
txtMessageDisp.Text = txtMessageDisp.Text & vbNewLine & "SYSTEM: Accepted a New Connection on Winsock " & (Winsock.UBound)
'sckWinsock1.Close 'this resets the socket ready to accept the incoming connection
'sckWinsock1.Accept requestID 'accept the connection!
End Sub