Sinan Tuzcu Well-Known Member Licensed User Longtime User Feb 10, 2019 #1 Helo, is it possible to get New Data from AStreams_NewData as String and not Byte? I have try like below, but doesn't works. I get only an Error msg. B4X: Sub AStreams_NewData (Buffer As String) Dim msg As String End Sub
Helo, is it possible to get New Data from AStreams_NewData as String and not Byte? I have try like below, but doesn't works. I get only an Error msg. B4X: Sub AStreams_NewData (Buffer As String) Dim msg As String End Sub
walterf25 Expert Licensed User Longtime User Feb 10, 2019 #2 Sinan Tuzcu said: Helo, is it possible to get New Data from AStreams_NewData as String and not Byte? I have try like below, but doesn't works. I get only an Error msg. B4X: Sub AStreams_NewData (Buffer As String) Dim msg As String End Sub Click to expand... You can use the AsyncStreamText Class instead https://www.b4x.com/android/forum/t...eful-when-working-with-streams-of-text.27002/ Regards, Walter Upvote 0
Sinan Tuzcu said: Helo, is it possible to get New Data from AStreams_NewData as String and not Byte? I have try like below, but doesn't works. I get only an Error msg. B4X: Sub AStreams_NewData (Buffer As String) Dim msg As String End Sub Click to expand... You can use the AsyncStreamText Class instead https://www.b4x.com/android/forum/t...eful-when-working-with-streams-of-text.27002/ Regards, Walter
Erel B4X founder Staff member Licensed User Longtime User Feb 11, 2019 #3 Watch the video tutorials. They explain these things. Generally speaking, you can convert an array of bytes to a string with: B4X: Dim msg As String = BytesToString(Data, 0, Data.Length, "utf8") It is likely that AsyncStreamsText is better for your use case. Upvote 0
Watch the video tutorials. They explain these things. Generally speaking, you can convert an array of bytes to a string with: B4X: Dim msg As String = BytesToString(Data, 0, Data.Length, "utf8") It is likely that AsyncStreamsText is better for your use case.