i a using asyncstream as a tcp client to receive text and split them each 10 milliseconds
this is the text that i am receiving from the server
this records could increased based on database
my newdata to recive those records inside service looks like this
i got a problem to split the received records using regex.split the length should always count 2 based on those 2 records
but some times it gets conflicted of the messages received too fast so the length becomes 3 and the split faild
the split should do the records like following
but some times records got conflicted together is what i am doing is right to handle data with asyncstream ?
this is the text that i am receiving from the server
B4X:
1GETNAMES&Mark~active~~105~
1GETNAMES&TOM~active~~101~
this records could increased based on database
my newdata to recive those records inside service looks like this
B4X:
Public Sub NEWCHATDATA(data() As Byte)
Dim arrvmsg As String
arrvmsg = BytesToString(data, 0, data.Length, "UTF-8")
arrvmsg = arrvmsg.Trim
arrvmsg = arrvmsg.Replace(CRLF, "")
If arrvmsg.Length = 0 Then
Log("Error")
Return
End If
Handlcmdstrings(arrvmsg)
End Sub
Public Sub Handlcmdstrings(CMDS As String)
Dim userlinadd As String
Try
If CMDS.Length = 0 Then
Log("Error")
Return
End If
Log(CMDS)
paramnum = Regex.Split("\&", CMDS)
If paramnum(0) = "1GETNAMES" Then
userlinadd = paramnum(1)
Log(paramnum.Length)
CallSub2(Main, "DISPLAYUSER", userlinadd)
End If
Catch
Log("Error")
End Try
End Sub
i got a problem to split the received records using regex.split the length should always count 2 based on those 2 records
but some times it gets conflicted of the messages received too fast so the length becomes 3 and the split faild
the split should do the records like following
B4X:
paramnum(0) will be equal to 1GETNAMES' and paramnum(1) should always get the rest of result for each sending line
but some times records got conflicted together is what i am doing is right to handle data with asyncstream ?