Sending hexadecimal over TCP

Hi there,

Is there a way to send raw hexadecimal data over TCP ?

I tried :

x = NetAddr("192.168.123.123", 1245).connect();

x.sendMsg([0xAA, 0xBB, 0xCC]);
x.sendMsg(0xAA, 0xBB, 0xCC);
x.sendRaw(#[0xAA, 0xBB, 0xCC]);

Is it the case that .sendMsg, and .sendRaw both send only OSC data ?

If I send :
[0xaa, 0xbb, 0xcc]
I get in Wireshark :
00 00 00 10 00 00 00 aa 2c 69 69 00 00 00 00 bb 00 00 00 cc 2c 00 00 00

or just :
0xaa, 0xbb, 0xcc β†’ 00 00 00 aa 2c 69 69 00 00 00 00 bb 00 00 00 cc

^Both of which makes me think it is encapsulated somehow.

Any thoughts on the topic ?

Use case :
I have a PTZ Camera that documents his network API e.g.: some arbitrary iris position would be :
8F 01 04 4B 00 00 0F 00 FF
to be sent at the camera IP port 1259.

I think you want sendRaw(Int8Array[0xaa, 0xbb, 0xcc]). sendRaw expects a RawArray subclass; trying to send #[0xaa...] produces an error for me actually. And, an integer literal is 4 bytes, not 1, which is why you want to place it in an Int8Array, otherwise it would likely be 0x000000aa (or some endian permutation of it) when sent.

That’s exactly what I needed. Your help is very much appreciated, thank you.

1 Like