public IPAddress ReadIPAddress()
{
switch (ReadUInt8())
{
case 0:
return new IPAddress((uint)ReadInt32LE());
case 1:
{
var ip6Bytes = Get16Bytes();
ReadBlock(ip6Bytes);
return new IPAddress(ip6Bytes);
}
case 2:
{
var ip6Bytes = Get16Bytes();
ReadBlock(ip6Bytes);
var scopeid = (long)ReadVUInt64();
return new IPAddress(ip6Bytes, scopeid);
}
default: throw new InvalidDataException("Unknown type of IPAddress");
}
}