📄 readme
字号:
This example demonstrates use of the pSOS library 'dns', which allowsa TriMedia-based application to use the dynamic host-name lookupfacilities of the Internet. After including the header file <dns.h> and calling theinitialisation function res_start(), the following calls are available: char *name = (*a host name, e g, "www.altavista.com"*); char addr [4] = (*a host address, e g, "{127, 0, 0, 1}*); struct hostent host; /*buffer to receive result*/ int gethostbyname (name, &host); int gethostbyaddr (addr, sizeof addr, AF_INET, &host); Afterwards, the "host" structure has been filled in with host.h_name The official name of host host.h_aliases An alias list---always NULL host.h_addrtype Host address type---always AF_INET host.h_length Length of address---always 4 for I P host.h_addr_list A pointer to a NULL_terminated array of pointers to I P addresses. The example program sits in a loop reading host names from theuser. Each name is passed to gethostbyname() and the address is printedout. A blank line terminates the program. Host communication is done via the SerialRPC library, whichimplements the TriMedia host interface over the internet.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -