Thanks all,
@jmon :I did use MQTT before so I should have recalled it..
@Erel : will B4xSerializator take care of the buffersize limit as mentioned in the old tutorial? Can I pass it all the data (whithin "acceptable" limits) returned by my SQL select, no worrying about its overall size?
Do you mind to clean up/correct the following code?
Server sending a list
'in Sub Handle(req As ServletRequest, resp As ServletResponse)
...
Dim tdl As List
tdl=PrepareTDL
SendObject(tdl,resp.OutputStream)
...
'send the list to B4A app
Sub SendObject (Obj As Object, Out As OutputStream)
Dim ser As B4XSerializator
Dim buffer() As Byte
buffer=ser.ConvertObjectToBytes(Obj)
Out.WriteBytes(buffer, 0, buffer.Length)
end sub
B4A client receiving the list
'in Sub JobDone (Job As HttpJob)
...
Case "job4"
Dim out As OutputStream
out.InitializeToBytesArray(0)
File.Copy2(Job.GetInputStream, out)
Dim ar() As Byte
ar=out.ToBytesArray
Dim ser As B4XSerializator
Dim tdl As List = ser.ConvertBytesToObject( ar)
The above works but I'm not sure it's the proper way to do it.
A further question is: when sending more than one object (let's say a list followed by its number of items or a control code), should I simply call SendObject twice, consecutively?
udg