Android Question Mqtt chat autodiscovery multiple App

postasat

Active Member
Licensed User
Hi,
is it possible to use two app in the same device to chat with the same server app ?
if I use the same port for two app, I have an error (EADDRINUSE).

If I set two different port in every "client" app (for example 51042 and 51043) what I must change in the server app ?

Thank you.
 

postasat

Active Member
Licensed User
Hi Erel,
i use a tablet as server (on the same wifi net with my phone) and I need to have two different app on my phone (with the same mqtt autodiscovery function), I will start one app or the other when needed.
When I exit from one app and I start the other app, the app doesn't start and crash with error (EADDRINUSE - same address).
I had an error too, launching one app as first after phone restarted (maybe android launch "starter" on startup ?)

Is it possible to use two different port for every app with only one "server" ?

Thank you.
 
Upvote 0

postasat

Active Member
Licensed User
Hi Erel,

I could move all the instruction from Starter Service_start to a new Starter subroutine and call it only when I need to start the chat with autodiscovery function.
when I exit the "connection" function/activity in my app, I could call another Sub in Starter to close the Udp with
B4X:
autodiscover.Close
.

If I stop with
B4X:
autodiscover.Close
it's enough to launch the same chat with autodiscovery function in another app or I must close the broker too ?

Thank you.
 
Upvote 0
Top