Hey,
I understand that you are trying to send multiple UDP messages of different sizes from one xPC Target to another, and you are facing an issue where the receiving buffer sometimes contains mixed or incomplete messages due to how UDP packets are handled by the 'Ethernet Rx' block. This usually happens because UDP does not guarantee message boundaries, causing the receiver to possibly get concatenated or split messages in the buffer. To address this, it is recommended that each message be prefixed with its length (for example, a 2-byte header), and a buffer parsing routine be used on the receiver side to read the length, extract complete messages, and retain any leftover bytes for the next cycle using a persistent variable. Such logic can be implemented with a 'MATLAB Function' block.
For further details on UDP communication in Simulink, you can refer to [Communicate Using UDP](https://www.mathworks.com/help/releases/r2024b/simulink/ug/communicate-using-udp.html), and for guidance on using persistent variables, you can refer to [Persistent Variables in MATLAB Function Blocks](https://www.mathworks.com/help/releases/r2024b/simulink/ug/persistent-variables-in-matlab-function-blocks.html).
Hope this helps