|
-
Dec 13th, 2004, 03:16 PM
#1
Thread Starter
Banned
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.
-
Dec 13th, 2004, 03:18 PM
#2
Thread Starter
Banned
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
-
Dec 14th, 2004, 09:08 AM
#3
Thread Starter
Banned
-
Dec 14th, 2004, 09:11 AM
#4
Hyperactive Member
Re: wierd data behavior
 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

-
Dec 14th, 2004, 09:18 AM
#5
Hyperactive Member
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

-
Dec 14th, 2004, 09:49 AM
#6
Thread Starter
Banned
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
-
Dec 14th, 2004, 10:02 AM
#7
Thread Starter
Banned
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|