B4R Question SOLVED - Listening for / having multiple connections open

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I have a B4R program that sends IR signals to control devices in the house.
It receives commands through wifi commands using Sockets.

I can talk to the B4R program from multiple Android devices if I close the socket (in the Android device) after each command.

But the delay of reconnecting to send a command makes the Remote program to sluggish (doesn't perform as well as if I maintain an open connection).

I would like the B4R program to be able to handle multiple Open connections at the same time.

Basically my phone, my wife's phone and a table or two should be able to connect to the B4R program (and maintain and open connection)

I have looked at as many socket examples as I could. But still am unsure how to do this.

Do I create an array of WiFiServerSocket and/or WiFiUDP sockets in the B4R program?
Do I use different Control Ports? If different control ports how do I find out which port is being used on the Android side so it uses a different port?
 

barx

Well-Known Member
Licensed User
Longtime User
I would probably create a mini web api and use different routes to control different things. That, or maybe a MQTT broker.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Went back to using the Time in the Android code but changed the timeout to be 15 seconds.
This way you can do some fast channel switching without reconnecting but after 15 seconds you are disconnected.

Every time the Android sends a request to the B4R it resets the time.

Think this such work.
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Which infrared led have you used and at what distance can it function? Can you post it's DigiKey page?
 
Upvote 0
Top