Android Question AsyncStreams with Lollipop very slow

welu1805

Active Member
Licensed User
Longtime User
Hi all,

I use for testing of AsyncStreams a small app similar to AsyncStream Tutorial from Feb, 3, 2011. I have to transmit short commands, only 1 to max. 10 chars.

It works very fine and fast with 2 Jellybean and 1 KitKat tablets. But with a Lollipop (5.1.1) tablet sometimes it takes until 25 s to transmit 1 char! In both directions: Lollipop as server and later as client. The transmit with my app is only from server to client.

Has anyone the same problem? Must I change settings in Lollipop?

Thanks for help
Lutz
 

welu1805

Active Member
Licensed User
Longtime User
Hi Erel,

I uploaded the small code. If possible, test it with Lollipop.

Lutz
 

Attachments

  • TestAsyncLollipop.zip
    8.2 KB · Views: 251
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
I've tried your code with an Android 6 as the client and the PC as the server. The messages arrived more or less immediately.

You can try it with this B4J program (non-ui):
B4X:
Sub Process_Globals
   Private astream As AsyncStreams
   Private server As ServerSocket
   
End Sub
Sub AppStart (Args() As String)
   server.Initialize(51042, "server") 'make sure that firewall allows incoming connections.
   server.Listen
   StartMessageLoop
End Sub

Sub server_NewConnection (Successful As Boolean, NewSocket As Socket)
   Log("new connection")
   astream.InitializePrefix(NewSocket.InputStream, False, NewSocket.OutputStream, "Astream")
End Sub

Sub Astream_NewData (Buffer() As Byte)
   Log(BytesToString(Buffer, 0, Buffer.Length, "UTF8"))
   astream.Write("test".GetBytes("utf8"))
End Sub
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…