Android Question For the creation of a little game, I would like to find the fastest way to send integers values

Ponslet

Member
Licensed User
Hello,
In summary, what I'm looking for is quite simple:
For the creation of a little game, I would like to find the fastest way to send values (integers) between two Android phones connected via 4g (or 5g)

In this case is it mandatory to go through an intermediate server (node.js seems appropriate)?

Or is there a way to communicate very quickly between two android phones connected via 4g (or 5g) (located in different places - not in the same network)

(it's for a game, so ideally, it would take a latency of a few tenths of a second maximum)
Can you help me?
Thanks very much.
 

Ponslet

Member
Licensed User
jdrc2 works with third party, server and database.
MQTT and Websocket with a server too...
If I understood correctly, the clients need to connect first to a server.

I remind that I just want to pass a few "integers" variables, so going through a database system or a server seems a bit cumbersome to me.
But maybe that's not possible?
Thanks a lot.
 
Upvote 0

Ponslet

Member
Licensed User
Hello , thanks for your help.
Finally I found this :


It works very well and very fast in a local Wifi network with the IP addresses 192.168.1.... on two phones.

But if I test on two phones with 4g (without local Wifi network)
I search with watsmyIP... for the real IP address from the two phones.
But in this case, I do not get a connection?
Do you have any idea why in 4g it doesn't work? fix?

thank you in advance
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
First of all you must have knowledge of networks... and real ip as you know targeting your router that you must nat/forward specific port to your device... at 4g and 5g ports are always closed by the provider...

And that is the basic reason you need a third device.. vps.. a server like to communicate with an open port..
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
Something like server: You need a public place to leave your values and read them anytime from any device..

Could be a database at a cheap vps with public ip preferably... and better have the feature running java.. to use jrdc2

You can also use direct connection to vps database for more cheaper solution..but may be lose..some records..+not the best security

Search b4x forum you will find 100nd solutions..
 
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
As mentioned above, 4G and 5G networks are intended for phone to phone communication (voice or texting), and do not have public access points.
But I do see what you wish for.

Imagine you are calling another device to speak on the phone. While the line is open you can communicate with the other party at a respectable fast rate.
Now, how can you use that open line to communicate data for your game. Remember the line needs to be kept open, otherwise your latency will be affected.
Therefore texting is not practical.

If you have a free plan for a region, then open lines may be practical, for example I have a free plan for within Canada cell phone use.
Then if you could encode digits to sounds and decode then back, you could have what you want. For example DTMF.
This is a lot of ifs, and DTMF (touch tones) are not very reliable.

Food for thought.
 
Upvote 0
Top