Results 1 to 7 of 7

Thread: wierd data behavior

  1. #1

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

    Resolved wierd data behavior

    ok this is really string

    using winsock TCP the data seems to misplace...

    i send this to my server:
    sckmsglogin = 1, name = aaaaaaaaaaa, pass= ""
    Call Main.Socket.SendData(CStr(sckMsgLogin) & sckSep & Name & sckSep & Pass & sckEnd)

    then it arives as: "aaa1 aaaaaaa "
    Last edited by nareth; Dec 14th, 2004 at 10:02 AM.

  2. #2

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

    Re: wierd data behavior

    my recieve funciton is

    Private Sub Client_DataArrival(Index As Integer, ByVal bytesTotal As Long)
    Dim Buffer As String
    Dim I As Long

    Debug.Print "start;"
    Call Client(Index).GetData(Buffer, vbString, bytesTotal)
    Let Client(Index).Tag = Client(Index).Tag & Buffer
    Debug.Print "buffer;" & Client(Index).Tag

    Let I = InStr(1, Client(Index).Tag, sckSep)
    If I < 2 Or I > 3 Then
    Call AddBan("Server", Client(Index).RemoteHostIP, "Wrong sckSep Position")
    Call Client_Close(Index)
    Exit Sub
    End If

    Let I = InStr(1, Client(Index).Tag, sckEnd)
    While I
    Let Buffer = Left$(Client(Index).Tag, I)
    Debug.Print "packet;" & Buffer
    Let Client(Index).Tag = Right$(Client(Index).Tag, Len(Client(Index).Tag) - I)
    Debug.Print "buffer;" & Client(Index).Tag

    If Len(Buffer) Then
    Call ProcessData(Index, Buffer)
    End If

    Let I = InStr(1, Client(Index).Tag, sckEnd)
    Wend
    Debug.Print "end;"
    End Sub

  3. #3

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

    Re: wierd data behavior

    bump

  4. #4
    Hyperactive Member mudfish's Avatar
    Join Date
    Feb 2004
    Location
    Chit Chat
    Posts
    353

    Re: wierd data behavior

    Quote Originally Posted by nareth
    then it arives as: "aaa1 aaaaaaa "
    The only thing I can think of is it pick up an "enter"
    Ascii = 13

    and looking at the code I do not see why.

    Just a thought.
    Mudfish AKA Bowfin
    I can spell "If" all day right, just a coder!


    "Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway

    Member of the ECCC

  5. #5
    Hyperactive Member mudfish's Avatar
    Join Date
    Feb 2004
    Location
    Chit Chat
    Posts
    353

    Re: wierd data behavior

    Here some code that I use to trim, when I have used the buffer.

    strUserID_Form_Load = Left$(strUserName_Form_Load, InStr(strUserName_Form_Load, Chr$(0)) - 1)
    Mudfish AKA Bowfin
    I can spell "If" all day right, just a coder!


    "Always do sober what you said you'd do drunk. That will teach you to keep your mouth shut." -- Ernest Hemingway

    Member of the ECCC

  6. #6

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

    Re: wierd data behavior

    it has nothing to do with trimming the packets

    it arives WRONG:

    Let Client(Index).Tag = Client(Index).Tag & Buffer
    Debug.Print "buffer;" & Client(Index).Tag

  7. #7

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

    Re: wierd data behavior

    haha got it somehow the .Tag member screwed it up. when connected i made the .tag value vbnullstring

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