Android Question HttpServer OutputStream

XbNnX_507

Active Member
Licensed User
Longtime User
Hi, i'm using this library https://www.b4x.com/android/forum/t...er-in-your-android-application.25984/#content.

Whenever i try to write bytes to the outpustream with this code:
B4X:
        Dim r As Reflector
        r.Target = Response
        Dim jo As JavaObject = r.GetField("res")
        Dim ser As B4XSerializator
            
        Dim out As OutputStream = jo.RunMethod("getOutputStream", Null)
        Dim data() As Byte = ser.ConvertObjectToBytes( Object )
        out.WriteBytes( data, 0, data.Length )

i get java.io.EOFException: Unexpected end of ZLIB input stream at client side.
B4X:
Sub JobDone ( j as httjob )
  if j.success then
          dim data() as byte = bit.inpustreamtobytes( j.getinpustream) '< '-- Error
 end if
End Sub

Is there something wrong ?
Thanks.
 

OliverA

Expert
Licensed User
Longtime User
You could cheat. You could Base64 encode the data() array and sent it with SendString. On the client side the GetString method would contain the Base64 encoded string.
 
Upvote 0

XbNnX_507

Active Member
Licensed User
Longtime User
You could cheat. You could Base64 encode the data() array and sent it with SendString. On the client side the GetString method would contain the Base64 encoded string.
Well i'm afraid this is not an option for me. The base64 overhead is just too much.
I'll look into another method to work with the bytes directly , given that there's not solution to my original problem.

Seems like HttpServer library is buggy.

Thanks.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…