Quote Originally Posted by emyztik
So, which should fix the problem? Now I'm confused
Use this:
Quote Originally Posted by DigiRev
Well, according to that code, k will never be > than .UBound

Try this

Code:
Private Function NextSocket() As Integer
    Dim i As Integer, intRet As Integer
    If wsServer.UBound = 0 Then
        Load wsServer(1)
        NextSocket = 1
    Else
        For i = 1 To wsServer.UBound
            If wsServer(i).State = sckClosed Then
                intRet = i
                Exit For
            End If
        Next i
        If intRet > 0 Then
            NextSocket = intRet
        Else
            intRet = wsServer.UBound + 1
            Load wsServer(intRet)
            NextSocket = intRet
        End If
    End If
End Function

Private Sub wsServer_ConnectionRequest(Index As Integer, ByVal requestID As Long)
    Dim i As Integer
    i = NextSocket
    If i > 0 Then
        wsServer(i).Accept requestID
    End If
End Sub