【发布时间】:2019-10-19 19:43:54
【问题描述】:
我在 c 中找到了 DNS 客户端的示例: https://www.binarytides.com/dns-query-code-in-c-with-linux-sockets/ 而且我不了解函数 ReadName() 中的一件事。 *reader 是指向 DNS 应答开头的指针,URL 是我们希望找到的 IP 地址。 我不明白那里的条件:
if(*reader>=192)
{
offset = (*reader)*256 + *(reader+1) - 49152; //49152 = 11000000 00000000 ;)
reader = buffer + offset - 1;
jumped = 1; //we have jumped to another location so counting wont go up!
}
else
{
name[p++]=*reader;
}
当 URL 的某些字符大于 192 时,这意味着什么?我们到底在做什么(在条件下)? 谢谢!
【问题讨论】: