Android Question B4A socket client

Nizze

Active Member
Licensed User
Longtime User
Hi
I'm trying to make a client that sends a question to a server and the server sends data back to my client .
But i only get the beginning of the message ( ~75-100 bytes ) i have not counted the bytes but it is always the same amount of data (Bytes )

I have tryed both with async and Socket but with the same result .
I must be missing something but i can't see what it is
I have been using the code that are in the samples

Sub TcpStreams_NewData (Buffer() As Byte)
Dim Msg As String
Dim components() As String
Dim temp As String
Dim Temp1 As String

Msg = BytesToString(Buffer, 0, Buffer.Length, "ASCII")
components = Regex.Split (";",Msg)

// and some more to decode my recived data

end sub



Is there a way to se when there are no more data to get from buffer or
must i send a "data_lenght" in my message that i can use to see i got all messege ?

That would not bee any problem , but i think there is something i missed..

Br

Nizze
 

goldmagnet

Member
Licensed User
Longtime User
Hi There

The TcpStreams_NewData event is raised when new data arrives, it does not mean all the data has arrived. If you use string builder to build your msg string then you can query the string each time your append more data to it waiting until your entire message had arrived.

Huw
 
Upvote 0
Top