Parse multi-byte integers from UDP data[]
in
Programming Questions
•
2 years ago
Hi All
Question:
What is the equivalent of C# BitConverter in Processing? If there is none, is it possible to read 4-byte integers and 2-byte integers from the data[] with Processing?
Backstory:
I am trying to read the UDP packets coming from Optitrack (industrial 3D Motion tracking system) with Processing. I learned that pocket is made of multi-byte data, such as 4-byte integers and 2-byte integers. It won't work with the UDP library examples using -> new String(data[]). I have no problem receiving data from the port, I just can't parse the data[] correctly.
Tried and not working:
1. Converting each byte to a string equivalent with char() and then concatenating.
2. add byte together based on the byte syntax (e.g byte(data[0]+data[1]) )
2. new String(data[]);
Thanks,
Kyle
Question:
What is the equivalent of C# BitConverter in Processing? If there is none, is it possible to read 4-byte integers and 2-byte integers from the data[] with Processing?
Backstory:
I am trying to read the UDP packets coming from Optitrack (industrial 3D Motion tracking system) with Processing. I learned that pocket is made of multi-byte data, such as 4-byte integers and 2-byte integers. It won't work with the UDP library examples using -> new String(data[]). I have no problem receiving data from the port, I just can't parse the data[] correctly.
Tried and not working:
1. Converting each byte to a string equivalent with char() and then concatenating.
2. add byte together based on the byte syntax (e.g byte(data[0]+data[1]) )
2. new String(data[]);
Thanks,
Kyle
1