B4J Question B4X] Network + AsyncStreams + B4XSerializator- single connection only

jimmyF

Active Member
Licensed User
Longtime User
I have put some time and effort into a server app that allows me to back up individual records from my B4A Android/SQLite db app to the server.
Works great!

Except...it only allows a single connection

So I have decided to use the Jetty server instead of sockets but the only server samples I see are web server actions and routines.
I really don't want a web interface.
I used to use .ashx (.asp without the interface) files that were incredibly fast. Then I went to PHP which are also very quick but difficult for me to learn (at my age! ).
I am probably not using the correct terminology for this request so please check with me if anything is unclear.

My question: Is using "server.AddHandler" the proper/most efficient way to do this or is there a better way?

Thanks
James F
 

EnriqueGonzalez

Well-Known Member
Licensed User
Longtime User
Jetty or jserver is multiconnection. Sqlite is too but up to a degree dont expect the same performance of business grade database.

If you use jrdc not necessarily needs to have a web interface. It could be simply a connector.
 
Upvote 0

jimmyF

Active Member
Licensed User
Longtime User
Gracias Enrique.
I have no problem with the database.
It is the network connector and it's methods that I am interested in learning about. I need a multi-user networking connection.
I saw a posting about multiple web sockets as a class and multiple instances loaded and re-used as required.
Maybe that is the route to go.
 
Upvote 0

jimmyF

Active Member
Licensed User
Longtime User
Thank you.

Can I use the same packaging?

For example:
Use a Type:
B4X:
Type MyMessage(Name As String, Age As Int, Image() As Byte)
And send like this:
B4X:
SendData (ser.ConvertObjectToBytes(mm))

And are there any size limitations?

Thank you for this.

j
 
Upvote 0

jimmyF

Active Member
Licensed User
Longtime User
What would that actual syntax be?
Is this correct?
B4X:
"http://mywebsite.com/myhandler/"  & ser.ConvertObjectToBytes(mm)
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

jimmyF

Active Member
Licensed User
Longtime User
Upvote 0

jimmyF

Active Member
Licensed User
Longtime User
actually, to send AND receive in Prefix mode. Or not Prefix mode
Is this possible?
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
actually, to send AND receive in Prefix mode. Or not Prefix mode
Is this possible?
What does this have to do with the solution that you are looking at with your post #10? That solution uses HTTP to send serialized objects to the server. The code in the project you link to (https://www.b4x.com/android/forum/t...device-desktop-and-web-reports.37254/#content) already shows you how to send objects from the client to the server. @Erel's post #11 shows you how the server can sent a serialized object back to the client and @Erel hints how you can read it back at the client (post above). The kicker is, you're pretty much re-inventing jRDC2 (https://www.b4x.com/android/forum/t...ation-of-rdc-remote-database-connector.61801/), a technology that was suggested to you by @Enrique Gonzalez R . At least look at the source of it (both server and client), since it has all the pieces you are looking for (when it comes to sending serialized objects back and forth via HTTP).

PS: was ninja'd by @Erel while writing this.
 
Upvote 0

jimmyF

Active Member
Licensed User
Longtime User
Sorry, I was over-complicating it.

It looks as if jRDC2 may be the solution. I originally discounted it because I thought I had read somewhere that it was not secure.
In any case, I will experiment with that.

Thanks for your help and patience.
 
Upvote 0

jimmyF

Active Member
Licensed User
Longtime User
In learning this new platform I had seen info on JdbcSQL and had wrongly associated it with jRDC.
I see now that the jRDC2 is the route to go and am already experimenting with it with success.

My background has been with Microsoft products on both the client and the server sides.
Originally with VB 1.0 For DOS, SQL Server, and asp connections.

Java was my morning pick-me-up!

Thank you @Enrique Gonzalez R , @Erel and @OliverA for the guidance.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…