Mar 13, 2024 Replies: 3 This is just a proof of concept to show that Device A behave like a server hosting a database and Device B connects to it accessing the "shared" database. It is a response to this question. Device A - Server (contains database) Device B - Client (does not have database) The idea is by implementing the Network example using AsyncStreams and B4XSerializator as explained here. Use "Server" build configuration to compile the server. Use "Default" build configuration to compile the client. In client app, enter the server's IP to connect to. You can also test with B4J. Attachments ShareDB.zip ShareDB.zip 17.6 KB · Views: 828 Last edited: Mar 13, 2024 Click to expand...
This is just a proof of concept to show that Device A behave like a server hosting a database and Device B connects to it accessing the "shared" database. It is a response to this question. Device A - Server (contains database) Device B - Client (does not have database) The idea is by implementing the Network example using AsyncStreams and B4XSerializator as explained here. Use "Server" build configuration to compile the server. Use "Default" build configuration to compile the client. In client app, enter the server's IP to connect to. You can also test with B4J.
aeric Expert Licensed User Longtime User May 31, 2024 #2 Can also replace SendData with following code. Old: B4X: Public Sub SendData (data() As Byte) If connected Then astream.Write(data) End Sub New: B4X: Public Sub SendData (Msg As Object) Dim data() As Byte = ser.ConvertObjectToBytes(Msg) If connected Then astream.Write(data) End Sub Then use as following: B4X: Dim Msg As Message = CreateMessage("REFRESH", ReadTodo) SendData(Msg)
Can also replace SendData with following code. Old: B4X: Public Sub SendData (data() As Byte) If connected Then astream.Write(data) End Sub New: B4X: Public Sub SendData (Msg As Object) Dim data() As Byte = ser.ConvertObjectToBytes(Msg) If connected Then astream.Write(data) End Sub Then use as following: B4X: Dim Msg As Message = CreateMessage("REFRESH", ReadTodo) SendData(Msg)
GiovanniO Member Oct 1, 2025 #3 Thank you for share this. I have a question, the server can connect to 4 devices -client side- at the same? Thanks again.
Thank you for share this. I have a question, the server can connect to 4 devices -client side- at the same? Thanks again.
aeric Expert Licensed User Longtime User Oct 2, 2025 #4 GiovanniO said: Thank you for share this. I have a question, the server can connect to 4 devices -client side- at the same? Thanks again. Click to expand... Theoretically yes.
GiovanniO said: Thank you for share this. I have a question, the server can connect to 4 devices -client side- at the same? Thanks again. Click to expand... Theoretically yes.