static void GetTcpData(GXDLMSSettings settings,
GXByteBuffer buff, GXReplyData data)
{
// If whole frame is not received yet.
if (buff.Size - buff.Position < 8)
{
data.IsComplete = false;
return;
}
int pos = buff.Position;
int value;
// Get version
value = buff.GetUInt16();
if (value != 1)
{
throw new GXDLMSException("Unknown version.");
}
// Check TCP/IP addresses.
CheckWrapperAddress(settings, buff);
// Get length.
value = buff.GetUInt16();
data.IsComplete = !((buff.Size - buff.Position) < value);
if (!data.IsComplete)
{
buff.Position = pos;
}
else
{
data.PacketLength = buff.Position + value;
}
}