I wanted to make a very fast android app to communicate with my home server running on ubuntu.
So I have made something with json flask, TCP sockets and UDP sockets.
I want information about my network, temperature reading, log events, devices that I made, my LED strip and more in the future.
The thing is I want the response of the LED strip as fast as possible.
But also get other information.
So that it feels very reactive. Also in the future I wanted to implement something with my phone's x,y and z sensors. This has also to be very responsive.
Can anyone help me out which tech or something else is good for this kind off application.
Thanks in advance
We have used UDP connection in the driverless metro project. It is very fast but not reliable. So you need to write crosscheck statements with it.
My advice and answer is;
You can use UDP and also create a header for checking process. For example 2 Byte header for network checking. We did this in the Big Driverless metro project.
You should send the data each time when the receiver catch the data.
Sample;
[ 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 ] <-- 1 Byte, 8 Bit
0 --> Did receiver catch the data ?
1 --> If receiver catch data, make this bit 1 and resend to the sender.
2 --> Receiver to Sender
3 -->
8 --> Backup
You need to create a header byte data, and put your checking statements in it.
How to send temp
If you use UDP or TCP we can send ONU BYTE as a minimum data. Namely we can't send Bit. 1 Byte = 8 Bit
Sender to Receiver
1. Byte [
0 Bit --> Get temperature information
1 Bit -->
2. Byte [ Free]
Send every second and listen the receiver maybe It sends the information we don't need to request anymore. Check Receiver' first byte' first bit.
if its 0 keep sending
if its 1 ohh receiver sent temperature information look second byte its temperature
Receiver to Sender
Listen Sender, If sender sends data check first byte' first bit if its 0 doesn't care. If it 1 The sender requests temperature information from us. Send the temperature information to the sender. make first byte' first bit 1. make second byte temperature information.
1.Byte [ 0.bit zero or one]
2.Byte [ temperature inf]