当前位置: 首页>>代码示例>>C#>>正文


C# Internal.ReadBytes方法代码示例

本文整理汇总了C#中Internal.ReadBytes方法的典型用法代码示例。如果您正苦于以下问题:C# Internal.ReadBytes方法的具体用法?C# Internal.ReadBytes怎么用?C# Internal.ReadBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Internal的用法示例。


在下文中一共展示了Internal.ReadBytes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadRDATA

        internal override void ReadRDATA(Internal.ByteReader reader)
        {
            if (Base.RDLENGTH != 16)
            throw new InvalidResponseException(String.Format(
              "Invalid RDLENGTH value {0}: expected 16.",
              Base.RDLENGTH));

              byte[] buf = reader.ReadBytes(16);
              ADDRESS = new IPAddress(buf);
              if (ADDRESS.AddressFamily != System.Net.Sockets.AddressFamily.InterNetworkV6)
            throw new InvalidResponseException(String.Format(
              "Not an IPv6 address: {0}.", ADDRESS.ToString()));
        }
开发者ID:boethin,项目名称:dnstools,代码行数:13,代码来源:AAAA.cs

示例2: ReadRDATA

 internal override void ReadRDATA(Internal.ByteReader reader)
 {
     RDATA = reader.ReadBytes(Base.RDLENGTH);
 }
开发者ID:boethin,项目名称:dnstools,代码行数:4,代码来源:Default.cs

示例3: ReadRDATA

        internal override void ReadRDATA(Internal.ByteReader reader)
        {
            // The format of the data within a DNS TXT record is one or more
              // strings, packed together in memory without any intervening gaps
              // or padding bytes for word alignment.
              //
              // The format of each constituent string within the DNS TXT record is
              // a single length byte, followed by 0-255 bytes of text data.

              // TXT-DATA strings are not guaranteed to consist purely of ASCII printable
              // characters though this is usually the case.

              List<Datagram> strings = new List<Datagram>();
              for (int total = 0; total < Base.RDLENGTH; )
              {
            byte length = reader.ReadByte();
            if (length > 0)
            {
              if (total + length >= Base.RDLENGTH)
            throw new InvalidResponseException(
              "Invalid length byte in TXT record: String data would exceed RDLENGTH.");
              strings.Add(reader.ReadBytes(length));
            }
            total += (length + 1);
              }
              Strings = strings.ToArray();
        }
开发者ID:boethin,项目名称:dnstools,代码行数:27,代码来源:TXT.cs


注:本文中的Internal.ReadBytes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。