DNS 可在www.armecos.com下载完整文档。
请问那位高手移植过动态域名解析程序到ARM上 lizhenarm 发表于 2006-2-22 09:22 ZLG-ARM
你看看RFC1034/1035就知道如何写DNS程序了 gdtyy 发表于 2006-2-22 18:07:58 ZLG-ARM
你按照协议要求组成一个请求包,然后解析应答包内容就可以从域名得到IP地址。下面有一个示例,你可以参考一下。一般在单片机里实现的DNS就是指域名到IP转换,不必实现完整协议。你可以试试在ECOS或LINUX里找源码。
因为对外的IP地址可能动态变化,所以最好用域名,方便用户访问。 可以使用代理网关,或者ADSL,或CDMA等连接公网,关键是得到公网IP才能被访问,否则只能发起主动连接。当得到动态公网IP时,就刷新DNS,用户用DNS就能间接访问到WEB。
www.163.com域名解析实例(2005/03/08 12:45 test by YangYi)
dns send 29 bytes:0,0,1,0,0,1,0,0,0,0,0,0,3,77,77,77,3,31,36,33,3,63,6f,6d,0,0,1,0,1
dns recv 230 bytes:0,0,81,80,0,1,0,6,0,2,0,2,3,77,77,77,3,31,36,33,3,63,6f,6d,0, 0,1,0,1,c0,c,0,5,0,1,0,0,3a,c9,0,1d,3,77,77,77,5,63,61,63,68,65,5,73,70,6c,69,74 ,7,6e,65,74,65,61,73,65,3,63,6f,6d,0,c0,29,0,1,0,1,0,0,8,60,0,4,ca,6a,a8,6d,c0,2 9,0,1,0,1,0,0,8,60,0,4,ca,6a,a8,79,c0,29,0,1,0,1,0,0,8,60,0,4,ca,6c,24,99,c0,29, 0,1,0,1,0,0,8,60,0,4,ca,6a,a8,67,c0,29,0,1,0,1,0,0,8,60,0,4,ca,6a,a8,68,c0,33,0, 2,0,1,0,0,40,a0,0,c,9,6e,73,2d,73,70,6c,69,74,32,c0,39,c0,33,0,2,0,1,0,0,40,a0,0 ,c,9,6e,73,2d,73,70,6c,69,74,31,c0,39,c0,a2,0,1,0,1,0,0,3a,be,0,4,ca,6a,ba,7d,c0 ,ba,0,1,0,1,0,0,3a,b0,0,4,ca,6a,a8,4f
PASS:<www.cache.split.netease.com. is 202.106.168.109>
name = "www.163.com" <-----> IP = 202.106.168.109 |