i'm puzzling with the request of the http server https://www.b4x.com/android/forum/threads/embed-an-http-server-in-your-android-application.25984/
same program in b4j uses this input stream
how to fix this on android?
i tried this example, but failed
Sending a object back to the client android was no problem
same program in b4j uses this input stream
B4X:
Sub ReadObject (In As InputStream) As Object
Dim out As OutputStream
out.InitializeToBytesArray(0)
File.Copy2(In, out)
Dim raf2 As RandomAccessFile
raf2.Initialize3(out.ToBytesArray, False)
Dim res As Object = raf2.ReadObject(0)
Log(raf2.CurrentPosition)
raf2.Close
Return res
End Sub
i tried this example, but failed
B4X:
Dim upload As String = Request.GetUploadedFile("order")
File.Copy(server.TempFolder, upload, CurrentPath, Request.GetParameter("order"))
File.Copy(server.TempFolder, upload, File.DirRootExternal & "/" & bestanden.filedir, "1.dat") 'the file name is sent as a parameter
File.Delete(server.TempFolder, upload) 'delete the temporary file.
Sending a object back to the client android was no problem
B4X:
Sub sendobject(obj As Object, out As ServletResponse)
Dim raf As RandomAccessFile
raf.Initialize(File.DirRootExternal & "/" & bestanden.filedir, "1.dat", False)
raf.WriteObject(obj, True, 0)
out.SetContentType("application")
out.SendFile(File.DirRootExternal & "/" & bestanden.filedir, "1.dat")