コード例 #1
0
ファイル: DNSProxy.cs プロジェクト: DFishSoft/DnsService
        protected List <byte> addName()
        {
            List <byte> list = new List <byte>();

            if (Point != 0)
            {
                list.AddRange(BitConverter.GetBytes(IPAddress.HostToNetworkOrder(Point)));
            }
            else
            {
                string[] a = QueryName.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
                for (int i = 0; i < a.Length; i++)
                {
                    list.Add((byte)a[i].Length);
                    for (int j = 0; j < a[i].Length; j++)
                    {
                        list.Add((byte)a[i][j]);
                    }
                }
                list.Add(0);
            }
            return(list);
        }