B4J Question HTTP Server: chunked

wl

Well-Known Member
Licensed User
Longtime User
Hi,

I have been trying to keep the HTTP connection open and sending the HTTP response in chunked mode, but it seemsit is not working.

B4X:
    Dim bc As ByteConverter

    resp.SetHeader("Content-Length", 0)
    resp.SetHeader("Transfer-Encoding", "chunked")

    resp.OutputStream.InitializeToBytesArray(0)

    Do While (1=1)
        Dim ch() As Byte = bc.StringToBytes(CRLF & "1" & CRLF & "A" & CRLF, "ASCII")
        resp.OutputStream.WriteBytes(ch,0 ,ch.Length)
        resp.OutputStream.Flush

        Dim waitUntil As Long = DateTime.Now + 5000
        Do While (waitUntil < DateTime.Now)
        Loop
    Loop

Thanks
 

wl

Well-Known Member
Licensed User
Longtime User
Hi Erel,

I was looking into keeping the HTTP connection open for a while to be able to do some server side pushing.
 
Upvote 0
Top