ReadBytes

tznikos

Member
Licensed User
Longtime User
Hi,

Im new here, and nearly i found this create devolpment application for adroid.

Encounter the following problem
I have made an application where the mobile (Samsung Galaxy SNote II) communicates with a Server on Windows via TCP / IP in the simulator works perfectly I send data to the Server and the server can send me data.

On the mobile side i can send data but i can't receive data when i use the command ReadBytes stop with the following error android.os.NetworkOnMainThreadException

B4X:
           Dim inp As InputStream 
           inp = Srv.InputStream 
           Dim s As String 
           If inp.BytesAvailable >0 Then 
              Dim buffer(inp.BytesAvailable) As Byte 
              inp.ReadBytes( buffer,0, inp.BytesAvailable )
              s = BytesToString(buffer,0,buffer.Length ,"Windows-1253")   
             Msgbox( s,"")
        End If
 
Last edited:
Top