I am with a small problem here. I use a VB6 server in my PC, talking with my phone, acting as a client. I use Astreams to comunicate. The messages are concateneted in a string, in the phone.
The problem:
I can send to phone blocks of 1400 bytes and nothing more, or the App crashes. How can I increase the block size to something around 10KBytes ?
The message is a picture BASE64 string. 1400 bytes at once is ok, but the proccess become very lazzy. I'd like to increase speed sending
blocks bigger tham 1400 bytes. Reading the error message, I could see, the problem is with the bitmap charge.
The error message is:
main_auxiliar_foto (java line: 770)
java.lang.RuntimeException: Error loading bitmap.
at anywheresoftware.b4a.objects.drawable.CanvasWrapper$BitmapWrapper.Initialize2(CanvasWrapper.java:539)
at b4a.example.main._auxiliar_foto(main.java:770)
at b4a.example.main._recebeu(main.java:2637)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1083)
at anywheresoftware.b4a.keywords.Common.CallSubNew2(Common.java:1038)
at b4a.example.starter._astream_newdata(starter.java:201)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.BA$2.run(BA.java:370)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8019)
at java.lang.reflect.Method.invoke(Native Method)
BTW, this totally explains why your bitmap code is failing (you're only getting a fragment of your bitmap). It would have been really nice if you would have explained your project better between this post on the other post.
Update: Since you're using a VB6 server to send the info, you'll have to device a means to communicate START and STOP of the message sent from the server to the client.
The Server splits the string in several 1400 bytes blocks and sends them, one by one answering client's requests. As the string is completely sent, the VB6 send an END message closing the section.
Each part received by the Phone is concatened in a final string.
FinalString = FinalString & ReceivedString
When I try to charge the bitmap with FinalString the error happens and crashes the app.
The Server splits the string in several 1400 bytes blocks and sends them, one by one answering client's requests. As the string is completely sent, the VB6 send an END message closing the section.
Are you checking on the phone that you are getting 1400 bytes? Are you checking that the final FinalString is the same length as the complete string that your server was trying to send? Are you sure you’re not accidentally appending the END indicator to your FinalString? Can you post (in a text file) one of the sent and the equivalent received Data URLs?