B4R Question Http request chrome x android

Humberto

Active Member
Licensed User
Longtime User
I develop a software to ESP8266 that receive some commands from client as to test a connection to a AP, read EEPROM and more

I did the test using Chrome from a cell phone and the answer was ok, usualy text like characteres saved at EEPROM.

Now I´m doing the same with an app from android using "HttpJob"

B4X:
        Job.Initialize ( "", Me )
        xUrl = "http://192.168.4.1/set/eeprom/"          Job.Download ( xUrl)
        Wait For (Job) JobDone(Job As HttpJob)
        If Job.Success Then
            'The result is a json string. We parse it and log the fields.
            xResp = Job.GetString
            Try
                xResp = SU.DecodeUrl( xResp, "UTF8" )
            Catch
                Log(LastException)
            End Try
            Log ( xResp)
        Else
            Log (Job.ErrorMessage    )
        End If
        Job.Release

I´m Get this error in Android app

ResponseError. Reason: java.io.IOException: unexpected end of stream on okhttp3.Address@54dbe408, Response:

In B4R the code is like this

B4X:
Private Sub Astream_NewData (Buffer() As Byte)

                    Astream.Write("VoltaIP: ".GetBytes)
End Sub
 
Top