Closed sphaero closed 1 year ago
@sphaero the (
character is the byte count prefix for the TCP message. In this case the OSC message is 40 bytes (16 bytes for the path, 8 bytes for the typestring + padding, 4 bytes each for the int and float, and 8 bytes for the string "hello").
But why is it there. A regular netcat doesn't show any size prefixes? Is liblo adding a prefix when TCP is the transport?
Hi @sphaero, when OSC is sent over UDP, there is one message per datagram, so there is no need to packetize.
However, when sent over a TCP connection, multiple messages can be sent on the same stream, so they must be packetized some way. Liblo supports two methods of packetization. One is prefix-count, where a 32-bit integer is prepended to every message indicating how long it is. The other way, which seems to be more generally accepted, but not Liblo's default, is the SLIP protocol, which marks end-of-message with a special code.
On the server side, when Liblo accepts an incoming TCP stream, it sniffs out which method is being used based on the first few bytes.
Closing due to inactivity.
I'm trying to trace why sending OSC through TCP (oscsend utility) gets data prepended. See this for example:
On one terminal run netcat:
Then send an osc packet through tcp on a second terminal:
In the first (netcat) terminal you will receive this output:
What's that '(' character doing in front there?
If you try the same with UDP it doesn't give this character (
oscsend osc.udp://localhost:1234 /sample/address iTfs 1 3.14 hello
andnc -lun 127.0.0.1 1234
). See this output from netcat: