免费观看又色又爽又黄的小说免费_美女福利视频国产片_亚洲欧美精品_美国一级大黄大色毛片

ubuntu域名解析怎么使用

這篇“ubuntu域名解析怎么使用”文章的知識點大部分人都不太理解,所以小編給大家總結了以下內容,內容詳細,步驟清晰,具有一定的借鑒價值,希望大家閱讀完這篇文章能有所收獲,下面我們一起來看看這篇“ubuntu域名解析怎么使用”文章吧。

從網站建設到定制行業解決方案,為提供成都做網站、網站設計服務體系,各種行業企業客戶提供網站建設解決方案,助力業務快速發展。成都創新互聯將不斷加快創新步伐,提供優質的建站服務。

1.獲取域名解析的程序,將以下代碼保存為“main.cpp”。

#include

#include

#include

#include

extern int h_errno;

int main(int argc, char **argv)

{

if (argc != 2) {

printf("Use example: %s www.google.com\n", *argv);

return -1;

}

char *name = argv[1];

struct hostent *hptr;

hptr = gethostbyname(name);

if (hptr == NULL) {

printf("gethostbyname error for host: %s: %s\n", name, hstrerror(h_errno));

return -1;

}

//輸出主機的規范名

printf("\tofficial: %s\n", hptr->h_name);

//輸出主機的別名

char **pptr;

char str[INET_ADDRSTRLEN];

for (pptr=hptr->h_aliases; *pptr!=NULL; pptr++) {

printf("\ttalias: %s\n", *pptr);

}

//輸出ip地址

switch (hptr->h_addrtype) {

case AF_INET:

pptr = hptr->h_addr_list;

for (; *pptr!=NULL; pptr++) {

printf("\taddress: %s\n",

inet_ntop(hptr->h_addrtype, hptr->h_addr, str, sizeof(str)));

}

break;

default:

printf("unknown address type\n");

break;

}

return 0;

}

2.編譯程序,命令:

gcc main.cpp //會生成a.out文件

3.重命名&&拷貝&&權限修改,命令:

sudo cp a.out /usr/bin/dp

sudo chmod a+x /usr/bin/dp

4..執行域名解析,例如:

dp www.baidu.com

5.返回結果如下:

official: www.a.shifen.com

talias: www.baidu.com

address: 180.97.33.108

address: 180.97.33.108

以上就是關于“ubuntu域名解析怎么使用”這篇文章的內容,相信大家都有了一定的了解,希望小編分享的內容對大家有幫助,若想了解更多相關的知識內容,請關注創新互聯行業資訊頻道。

網站欄目:ubuntu域名解析怎么使用
鏈接分享:http://newbst.com/article46/jhsdeg.html

成都網站建設公司_創新互聯,為您提供品牌網站制作、電子商務、ChatGPT虛擬主機網站建設、網站設計公司

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

h5響應式網站建設