I am programming a Point Of Sale application using B4J which also communicates with remote devices via direct socket connection (using jNetwork and opening/using a ServerSocket connection). I want to use the open socket connection like a serial port, receiving queries from remote devices and sending data back)
I am storing POS data in a SQLite database (using jSQL / #AdditionalJar: sqlite-jdbc-3.7.2).
The active "front end" of the application is a typical POS interface, select products, change qty etc.
But I would like to have the communications / processing for remote devices occur in the "background" while the user operates the POS front-end.
As an example, the remote devices may send some kind of query request at any time (via Socket) and require a response from the POS (which typically involve the POS checking data in the SQLite database).
(If it makes things easier I can adjust remote devices to connect only when they make a request).
So my questions are:
1. How can I implement "background" receive, processing and send with B4J? (generally speaking, especially without pausing the front/main code)
2. Is there another way to implement background communications that is better than using direct socket communications? (The reason why I am using direct socket is that remote devices may be Arduino etc so don't want to make things too complex or use a lot of large libraries - some Arduinos like Nanos don't have much RAM / Flash memory). I am not using WebSockets because neither side is a browser (and also because I don't fully understand them).
3. Searching for "B4J background" only seems to bring up threads like https://www.b4x.com/android/forum/threads/server-background-workers.73269/#content
which is about jServer library. I don't know if background workers can only be done with jServer or if I can implement some sort of background function another way.
Thanks
I am storing POS data in a SQLite database (using jSQL / #AdditionalJar: sqlite-jdbc-3.7.2).
The active "front end" of the application is a typical POS interface, select products, change qty etc.
But I would like to have the communications / processing for remote devices occur in the "background" while the user operates the POS front-end.
As an example, the remote devices may send some kind of query request at any time (via Socket) and require a response from the POS (which typically involve the POS checking data in the SQLite database).
(If it makes things easier I can adjust remote devices to connect only when they make a request).
So my questions are:
1. How can I implement "background" receive, processing and send with B4J? (generally speaking, especially without pausing the front/main code)
2. Is there another way to implement background communications that is better than using direct socket communications? (The reason why I am using direct socket is that remote devices may be Arduino etc so don't want to make things too complex or use a lot of large libraries - some Arduinos like Nanos don't have much RAM / Flash memory). I am not using WebSockets because neither side is a browser (and also because I don't fully understand them).
3. Searching for "B4J background" only seems to bring up threads like https://www.b4x.com/android/forum/threads/server-background-workers.73269/#content
which is about jServer library. I don't know if background workers can only be done with jServer or if I can implement some sort of background function another way.
Thanks