Results 1 to 7 of 7

Thread: theory

  1. #1

    Thread Starter
    Banned nareth's Avatar
    Join Date
    Jun 2004
    Posts
    1,206

    theory

    i made this code, and i dont know if it works, and i cant test it right now, will you take a look and tell me what i need to change, add
    thanks

    Code:
    Private Sub Client_DataArrival(Index As Integer, ByVal bytesTotal As Long)
        Dim Buffer As String
        Dim I As Long
        
        Call Client(Index).GetData(Buffer, vbString, byestotal)
        Let Client(Index).Tag = Client(Index).Tag & Buffer
        
        Let I = InStr(1, Client(Index).Tag, sckSep)
        If I < 2 Or I > 3 Then
            Dim Ban As CBan: Set Ban = New CBan
            Let Ban.By = "Server"
            Let Ban.IP = Client(Index).RemoteHostIP
            Let Ban.Reason = "sckSep position < 2 or > 3"
            Let Ban.Time = CDate(Date$ & " " & Time$)
            
            Call DB.Bans.Add(Ban, Ban.IP)
            Call Client_Close(Index)
            Exit Sub
        End If
        
        Let I = InStr(1, Client(Index).Tag, sckEnd)
        While I
            Let Buffer = Mid$(Client(Index).Tag, 1, I)
            Let Client(Index).Tag = Right$(Client(Index).Tag, I + 1)
            
            If Len(Buffer) Then
                Call ProcessData(Index)
            End If
            
            Let I = InStr(1, Client(Index).Tag, sckEnd)
        Wend
    End Sub

  2. #2

    Thread Starter
    Banned nareth's Avatar
    Join Date
    Jun 2004
    Posts
    1,206

    Re: theory

    anyone

  3. #3
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: theory

    what is coming in through the buffer?

  4. #4

    Thread Starter
    Banned nareth's Avatar
    Join Date
    Jun 2004
    Posts
    1,206

    Re: theory

    i dont know i cant test the code yet... but can you see anything wrong?
    i also have a question... what does PeekData do?

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: theory

    should check the memory location. i was just wondering what SHOULD be coming through. I don't know how big the .tag buffer is, that's why i wondered.

  6. #6
    Frenzied Member
    Join Date
    Oct 2003
    Posts
    1,301

    Re: theory

    PeekData reads the received data without erasing it from the buffer afterwards.

  7. #7

    Thread Starter
    Banned nareth's Avatar
    Join Date
    Jun 2004
    Posts
    1,206

    Re: theory

    oooh...
    just like GetMsg and PeekMsg in the W32 SDK
    ok... so peekdata is useless

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width