Function rosc::decoder::decode_tcp

source ·
pub fn decode_tcp(msg: &[u8]) -> Result<(&[u8], Option<OscPacket>), OscError>
Expand description

Takes a bytes slice from a TCP stream (or any stream-based protocol) and returns the first OSC packet as well as a slice of the bytes remaining after the packet.

Difference to decode_udp

For stream-based protocols, such as TCP, the OSC specification1 requires the size of the first packet to be send as a 32-bit integer before the actual packet data.


  1. In a stream-based protocol such as TCP, the stream should begin with an int32 giving the size of the first packet, followed by the contents of the first packet, followed by the size of the second packet, etc.