Hi,
I am trying to send and receive messages from a remote tcp/ip device in real time. Both, the messages I send and the messages I receive are of variable length, where the header of each message defines it's length (the first two bytes define the length of the whole message in bytes).
While this is no problem for the send block, since it simply sends what enters it within the time of the fixed step size, the receive block uses a FIFO buffer of fixed length: I can either define the specific length of the message which will cause errors if I receive less than what I have defined within the timeout time I or can simply put out each byte by byte.
I am expecting new messages with a frequency of 500Hz (each 2ms) and will be sending in the same frequency.
The messages I am working with each have a header with 2 bytes that describe the length of the message. E.g. 0x00 0x05 0x56 0x00 0x02, where the 0x05 defines the message to be of length 5 byte.
Usually the message that I receive are of same length except for 5 initial messages and error messages.
Is there some way to add variable lengths using the knowledge withing the message's header, or are there other suggestions how to use the knowledge about the message length to find them inside of the data stream?
Thank you in advance.
EDIT: Is it possible to reset the FIFO buffer in each time step the status for receiving messages (in non-blocking mode) is = 0? When using a resettable subsystem I get an error message saying saying "Direct feedback connections involving nonvirtual subsystem 'untitled/Resettable Subsystem' are not allowed." because the reset for the subsystem come out of the subsystem and is therefore part of the loop.