I mean like this:
This code is from the server I made for work, wich we use for more than a year now...
VB Code:
Private Sub SckTCP_Close(Index As Integer) CClients = CClients - 1 SckTCP(Index).Close ClearUser Index If Index = 0 Then ConnectAllSockets End If End Sub Private Sub SckTCP_ConnectionRequest(Index As Integer, ByVal requestID As Long) Dim K As Integer, SHA As New clsSHA256, StrToSend As String For K = 1 To SckTCP.UBound If SckTCP(K).State = sckClosed Then Exit For Next K If K = SckTCP.UBound + 1 Then Load SckTCP(SckTCP.UBound + 1) Load tmrSendData(SckTCP.UBound) ReDim Preserve Clients(SckTCP.UBound) K = SckTCP.UBound End If Randomize Clients(K).State = 0 Clients(K).CLogIn.RndINIT = UCase(SHA.SHA256(CStr((2 ^ 30) * Rnd))) SckTCP(K).Accept requestID StrToSend = "RndINIT|" & Clients(K).CLogIn.RndINIT SckTCP(K).SendData Len(StrToSend) & ":" & StrToSend CClients = CClients + 1 End Sub




Reply With Quote