TelegramFormatSelectorSelectInboundTelegramFormat Method |
Namespace: Demo3D.HLE.Comms.Telegram
public virtual TelegramFormat? SelectInboundTelegramFormat( IEnumerable<TelegramFormat> formats, BufferSegment telegram )
By default, the method just iterates through the given formats
and follows the following algorithm:
- If the current format has fixed length and it matches the received telegram length, select that format. Otherwise
skip it.
- If the current format has dynamic length, select that format immediately.
For byte stream protocols (e.g. TCP) the received telegram data might comprise of multiple or incomplete telegrams. This requires the custom implementation of selection logic, achieved by extending TelegramFormatSelector and overriding SelectInboundTelegramFormat(IEnumerableTelegramFormat, BufferSegment) or SelectInboundTelegramFormats(IEnumerableTelegramFormat, BufferSegment).