B4J Question Help creating Client Server Application

Patrick Clark

Active Member
Licensed User
I would like to create a nonui server in B4J that can accept requests from another B4J application and supply a response.

Unless I am missing something all of the examples I can find use a web page as the querying application and I want to use a B4J application.

If I have missed it can someone point me at a suitable example or give me a hand on how to get started.

Thanks
 

Patrick Clark

Active Member
Licensed User
I have got the comms working. B4J Server and B4A Client but I need to be able to process multiple connections.

The examples seem to only allow one connection at a time. if another connection request is made the original socket is dropped.

Can you point me at anything else. I don't mind figuring out how to implement it (that is the fun of it) but i could really use some ideas.

I think i need to do something with this line on the server end
B4X:
            astream.InitializePrefix(NewSocket.InputStream, True, NewSocket.OutputStream, "astream")

and keep track of a number of streams
 
Upvote 0

Xandoca

Active Member
Licensed User
Longtime User
It would be my pleasure to help you but I don't know the solution šŸ˜ž. I suggest you create a new post with this specific point (I think you will probably get more answers).
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

Patrick Clark

Active Member
Licensed User
However unless you have a good reason, you will get better results and easier with MQTT or jServer.

Thanks Erel. I looked at the jServer examples but I couldn't find any examples of code that didn't implement some kind of browser html, so I moved on.

Does jServer allow non-ui/non-web applications to be built and are there any examples.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Does jServer allow non-ui/non-web applications to be built and are there any examples.
Yes
1) WebSockets. See the Push Messaging example (I know it also supports a web front end, but that does not have to be implemented). Source: https://www.b4x.com/android/forum/threads/webapp-web-apps-overview.39811/#content
2) Check out jRDC2. It communicates via serialized data. Source: https://www.b4x.com/android/forum/t...-rdc-remote-database-connector.61801/#content

Neither may be a perfect fit, but are options (if you are looking at jServer).
 
Upvote 0
Top