Click or drag to resize

TelegramFormatSelectorSelectInboundTelegramFormat Method

Selects the appropriate TelegramFormat, or null.

Namespace:  Demo3D.HLE.Comms.Telegram
Assembly:  Demo3D.HLE (in Demo3D.HLE.dll) Version: 15.0.2.11458
Syntax
C#
public virtual TelegramFormat? SelectInboundTelegramFormat(
	IEnumerable<TelegramFormat> formats,
	BufferSegment telegram
)

Parameters

formats
Type: System.Collections.GenericIEnumerableTelegramFormat
Formats to select from.
telegram
Type: Demo3D.IOBufferSegment
Received telegram data.

Return Value

Type: TelegramFormat
Selected format or null.
Remarks

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).

See Also