winsock chat server connection request help urgent
urgent help needed on winsock chat.
currently my code below is what i have its working.
Code:
Private Sub wsserver_ConnectionRequest(Index As Integer, ByVal RequestID As Long)
Dim iNextSocket As Integer
Dim i As Integer
Dim J As Integer
Dim itmx As ListItem
For i = lstUsers.ListCount - 1 To 0 Step -1
For J = 0 To List3.ListCount
If lstUsers.List(i) = List3.List(J) Then
kickuser
' lstUsers.RemoveItem (i)
Exit For
End If
DoEvents
Next J
DoEvents
Next i
iNextSocket = modServer.FindOpenSocket(Me)
'for multiple connections
Load wsServer(iNextSocket)
wsServer(iNextSocket).Accept RequestID
InsertText "Connected to " & RequestID
uUser(iNextSocket).Connection = "Connected"
uUser(iNextSocket).RequestID = RequestID
End Sub
i want to add this new code to this so it works smooth
Code:
For intMax = 1 To wsServer.count
On Error GoTo load1
If wsServer(intMax).Name = "" Then
End If
Next intMax
load1:
Load wsServer(intMax)
wsServer(intMax).LocalPort = 0
wsServer(intMax).Accept RequestID
InsertText "Connected to " & RequestID
wsServer(intMax).Tag = 1
List1.AddItem intMax
Set itmx = ips.ListItems.Add()
itmx.Text = intMax
itmx.SubItems(1) = wsServer(intMax).RemoteHostIP
itmx.SubItems(2) = "unknown"
itmx.SubItems(3) = "1"
End If
the code i posted on top is working fine but the code below am having problem adding to my current code which is on top please help me combine it