Sending UDP arrays

Hello everyone!
I am developing an app where I needed to send arrays of bytes with 3 hexadecimal elements in the UPD protocol ...
Right now I can send 1 array of just 1 byte, however, I don't know how to send this array for example [0x5,0x50,0x02] in a single udp packet ...
It turns out that with the image example, I can send the elements but in separate arrays ...
Can you help me please!
Thank you.
Bruno Santos, Portugal.

Which distribution are you using, it doesn't look like App Inventor?

You should ask on the forum for the distribution you develop on.

Regardless of distribution, there is a seriously wrong block in there that should be removed ...

Thanks for the answer!
But in fact, apart from that, the problem remains. because wireshark tells me if there are 3 arrays of 1 element each, not an array with 3 elements as intended.

Sorry, I don't understand!
I'm using the inventor app!

OK, you just have a very funky colour scheme :wink:

Do you have a link to the UDPXmitter extension documentation so we can figure out what it wants?

https://ullisroboterseite.de/android-AI2-UDP-en.html

I can send 1 byte for example 0xcc ...
But I can't even know how to send this array for example!
byte = [0xa5,0x50,0x02] ...

From the doc:

Binary Data

Transmitting

BinaryMode

If BinaryMode is set to true method Xmit accepts a string with coded bytes, separated by comma (‘,’) or semicolon.

Each bytes could be coded like “0xff” or “0xFF” or “0Xff” or “0XFF” or “#ff” or “#FF” for HEX input or “255” for decimal input or “0377” for octal input.

You can mix it if you want: “0xFF;255,#ff” is valid.

You can insert blanks before and after the number: “ 0xFF ; 255, #ff” is valid too.

A trailing comma or semicolon will be ignored: “0xFF;255,#ff” and “0xFF;255,#ff;” are identical.

Algorithm

This algorithm is used for the conversion:

  1. Replace all commas with semicolons
  2. Split the string using semicolons
  3. Delete leading and trailing spaces
  4. Conversion to Integer with Integer.decode()
  5. Check for values ​​<0 or> 255.

So this should be possible in AI2.

You only need to put that text into a text block,
set binary mode to true,
and send the text block.

no loop, no array.

oh, yes! Fantastic! It works! Thank you!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.