新聞中心
網(wǎng)絡(luò)是我們現(xiàn)代社會必不可少的一部分,大到全球互聯(lián)網(wǎng),小到局域網(wǎng)甚至個人電腦,我們每天都要使用網(wǎng)絡(luò)。但是,在網(wǎng)絡(luò)世界中,需要解析的信息實在是太多了,例如域名、IP地址等等,這些信息的解析顯得尤為重要。所以,網(wǎng)絡(luò)解析工具就顯得尤為重要。本文將介紹一個Linux網(wǎng)絡(luò)解析工具——adns。

創(chuàng)新互聯(lián)建站專注于安新企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站設(shè)計,商城系統(tǒng)網(wǎng)站開發(fā)。安新網(wǎng)站建設(shè)公司,為安新等地區(qū)提供建站服務(wù)。全流程定制網(wǎng)站建設(shè),專業(yè)設(shè)計,全程項目跟蹤,創(chuàng)新互聯(lián)建站專業(yè)和態(tài)度為您提供的服務(wù)
adns是一個開源的異步DNS解析庫,可以解析IPv4和IPv6地址,支持自定義服務(wù)端、自定義查詢類型等特性,以及多種使用方式。下面將介紹adns的安裝和使用方法,尤其是在Linux系統(tǒng)中的應(yīng)用。
安裝adns
adns的安裝十分簡單,可以使用源碼包安裝或者在Ubuntu系統(tǒng)下使用apt-get工具安裝。
如果您是在Ubuntu系統(tǒng)下安裝的話,只需要打開終端執(zhí)行以下命令:
“`
sudo apt-get install libadns1-dev
“`
如果您想使用源碼進行安裝,則需要按照以下步驟:
1.下載源碼包:
可以在官網(wǎng)(http://www.chiark.greenend.org.uk/~ian/adns/)下載最新的adns源碼包。
2.安裝依賴:
在安裝之前,您需要先安裝adns的必備依賴庫。這可以通過以下命令安裝:
“`
sudo apt-get install build-essential automake autoconf libtool
“`
3.解壓源碼包:
您可以使用“tar -zxvf”命令解壓adns源碼包,具體命令如下:
“`
tar -zxvf adns-1.5.1.tar.gz
cd adns-1.5.1
“`
4.編譯&安裝:
接下來,在安裝之前,您需要執(zhí)行以下命令進行配置:
“`
./configure
“`
當(dāng)配置執(zhí)行完成后,您需要使用以下命令進行編譯:
“`
make
sudo make install
“`
至此,adns已經(jīng)成功安裝到您的Linux系統(tǒng)中了。
使用adns
adns提供了幾種不同的使用方式:
1.使用adns_lookup函數(shù)查詢 DNS:
adns_lookup() 是adns庫的核心函數(shù),它的作用是向域名服務(wù)器詢問域名對應(yīng)的 IP 地址。
其函數(shù)原型如下:
“`
int adns_lookup(adns_state ads, const char *name, adns_rrtype otype, unsigned int flags, adns_query *query);
“`
由于adns_lookup()接口將DNS解析操作封裝了起來,因此它隱藏了DNS解析的具體細節(jié),對使用者而言,只需要提供域名和解析類型即可。
這里舉個例子:
“`
#include
int mn(int argc, char **argv) {
adns_state ads;
adns_init(&ads, adns_if_noerrprint, NULL);
adns_query query;
adns_submit(ads, “www.google.com”, adns_r_a, 0, &query,NULL);
adns_answer *answer;
int err = adns_wt(ads, &query, &answer, NULL);
if(0==err) {
printf(“%s\n”,inet_ntoa(((struct in_addr *) answer->item)->s_addr));
adns_free(answer);
}
adns_finish(ads);
return 0;
}
“`
通過以上代碼,我們可以向域名服務(wù)器查詢域名對應(yīng)的IP地址,例如,“www.google.com”的IP地址是172.217.3.100。
2.指定查詢DNS的服務(wù)器
使用 adns庫的核心函數(shù) adns_init() 來設(shè)置DNS服務(wù)器的地址,把需要向哪個DNS服務(wù)器查詢域名對應(yīng)的IP地址設(shè)置進去即可。在進行DNS解析時,adns將會優(yōu)先向指定DNS服務(wù)器發(fā)起查詢,如果沒有成功解析,才會嘗試其他DNS服務(wù)器。代碼示例如下:
“`
adns_init(&ads,adns_if_noerrprint,NULL);
adns_addserver(ads,”192.168.1.1″,0);
adns_query query;
adns_submit(ads, “www.google.com”, adns_r_a, 0, &query,NULL);
“`
3.觸發(fā)事件進行查詢
如果你正在使用類似輪詢、統(tǒng)一的主循環(huán)等方式進行任務(wù)處理,那么可以通過 adns_check() 函數(shù)檢查是否有DNS解析完成的事件。代碼示例如下:
“`
adns_query* queries[100];
while(1) {
unsigned int count = 100;
int err = adns_check(ads,queries,&count,NULL,NULL,NULL);
if(err) {
printf(“error\r\n”);
break;
}
for(int i=0; i
if(queries[i]) {
adns_answer* answer = NULL;
err = adns_getanswer(ads,queries[i], &answer,NULL,NULL,NULL);
if(err==0) {
printf(“host:%s address:%s\r\n”,queries[i]->owner,inet_ntoa(((struct in_addr*)answer->rdata)->s_addr));
}
adns_cancel(ads, queries[i]);
adns_free(answer);
}
}
adns_beforepoll(ads);
usleep(10 * 1000);
adns_afterpoll(ads);
}
“`
注意:以上示例代碼是在Linux系統(tǒng)中使用的,如果您想在其他系統(tǒng)中使用adns,需要進行相應(yīng)的修改。數(shù)據(jù)來源于網(wǎng)絡(luò),所有權(quán)歸原作者所有。
成都網(wǎng)站建設(shè)公司-創(chuàng)新互聯(lián)為您提供網(wǎng)站建設(shè)、網(wǎng)站制作、網(wǎng)頁設(shè)計及定制高端網(wǎng)站建設(shè)服務(wù)!
求高人幫我翻譯一下論文摘要
Paper abstract: Through uses the ADNS2610 image-forming sensors to manufacture the all scope precise position finder, mainly uses on the wheeled robot. May carry on the pinpointing in the 62M scope, the major function includes: Records when robot’s traveling schedule, the route, the homing calculates the minimum range, the direction judgment, many machine cooperation processing and so on. This sensor uses the ATMEGA16 monolithic integrated circuit to use in the image ysis processor, comes from ADNS2610 the data to carry on the ysis computation, then undergoes compression processing, passes to through the wireless tranission system the data the server (based on linux system’s formidable operation software), when after the server processes the data, again the instruction which or the data must carry out feeds. This sensor’s technical specification: Data acquisition precision: ±1mm; Data acquisition speed:
ADNS2610 imaging sensors by using a all-scale production of precise positioning system, and is mainly used for wheeled robot. Can be carried out within the scope of 62M accurate positioning, the main features include: Record robot’s itinerary, airline, owned by Air China for calculating the minimum distance, direction judgments, multi-machine cooperative processing. The sensors used for image ysis using the ATMEGA16 microcontroller processor, the ysis of data from the ADNS2610 calculations, and then through the compression processing, wireless tranission systems tranit data to a server (based on the linux system, a powerful computing software), when the server processing the data and then they want to perform the command or data sent back. This sensor technology indicators: data collection accuracy: ± 1mm; data acquisition speed: 500H; Data output interface: 232/IIC/ISP; Wireless Transfer Protocol: Self-set multi-machine transport protocol.
【我想大燃吵概這樣~??!
我不保豎仿證這文法余段纖百分百正確】
Abstract: ADNS2610 imaging sensors by using all-scale production of precise positioning system, and is mainly used for wheeled robot. Can be carried out within the scope of 62M accurate positioning, the main features include: Record robot’s itinerary, airline, owned by Air China for calculating the minimum distance, direction judgments, multi-machine cooperative processing. The sensors used for image ysis using the ATMEGA16 microcontroller processor, the ysis of data from the ADNS2610 calculations, and then through the compression processing, wireless tranission systems tranit data to a server (based on the linux system, a powerful computing software), when the server processing the data and then they want to perform the command or data sent back. This sensor technology indicators: data collection accuracy: ± 1mm; data acquisition speed: 500H; Data output interface: 232/IIC/ISP; Wireless Transfer Protocol: Self-set multi-machine transport protocol.
linux adns的介紹就聊到這里吧,感謝你花時間閱讀本站內(nèi)容,更多關(guān)于linux adns,Linux 網(wǎng)絡(luò)解析工具 adns 的使用教程,求高人幫我翻譯一下論文摘要的信息別忘了在本站進行查找喔。
香港云服務(wù)器機房,創(chuàng)新互聯(lián)(www.cdcxhl.com)專業(yè)云服務(wù)器廠商,回大陸優(yōu)化帶寬,安全/穩(wěn)定/低延遲.創(chuàng)新互聯(lián)助力企業(yè)出海業(yè)務(wù),提供一站式解決方案。香港服務(wù)器-免備案低延遲-雙向CN2+BGP極速互訪!
分享文章:Linux網(wǎng)絡(luò)解析工具adns的使用教程(linuxadns)
本文網(wǎng)址:http://m.fisionsoft.com.cn/article/cosigog.html


咨詢
建站咨詢
