📄 ne_addr_resolve.3
字号:
.\"Generated by db2man.xsl. Don't modify this, modify the source..de Sh \" Subsection.br.if t .Sp.ne 5.PP\fB\\$1\fR.PP...de Sp \" Vertical space (when we can't use .PP).if t .sp .5v.if n .sp...de Ip \" List item.br.ie \\n(.$>=3 .ne \\$3.el .ne 3.IP "\\$1" \\$2...TH "NE_ADDR_RESOLVE" 3 "5 July 2004" "neon 0.24.7" "neon API reference".SH NAMEne_addr_resolve, ne_addr_result, ne_addr_first, ne_addr_next, ne_addr_error, ne_addr_destroy \- functions to resolve hostnames to addresses.SH "SYNOPSIS".ad l.hy 0#include <ne_socket\&.h>.sp.HP 31ne_sock_addr\ *\fBne_addr_resolve\fR\ (const\ char\ *\fIhostname\fR, int\ \fIflags\fR);.HP 20int\ \fBne_addr_result\fR\ (const\ ne_sock_addr\ *\fIaddr\fR);.HP 36const\ ne_inet_addr\ *\fBne_addr_first\fR\ (ne_sock_addr\ *\fIaddr\fR);.HP 35const\ ne_inet_addr\ *\fBne_addr_next\fR\ (ne_sock_addr\ *\fIaddr\fR);.HP 21char\ *\fBne_addr_error\fR\ (const\ ne_sock_addr\ *\fIaddr\fR, char\ *\fIbuffer\fR, size_t\ \fIbufsiz\fR);.HP 22void\ \fBne_addr_destroy\fR\ (ne_sock_addr\ *\fIaddr\fR);.ad.hy.SH "DESCRIPTION".PPThe \fBne_addr_resolve\fR function resolves the given \fIhostname\fR, returning an \fBne_sock_addr\fR object representing the address (or addresses) associated with the hostname\&. The \fIflags\fR parameter is currently unused, and must be passed as 0\&..PPThe \fIhostname\fR passed to \fBne_addr_resolve\fR can be a DNS hostname (e\&.g\&. "www\&.example\&.com") or an IPv4 dotted quad (e\&.g\&. "192\&.0\&.34\&.72"); or, on systems which support IPv6, an IPv6 hex address, which may be enclosed in brackets, e\&.g\&. "[::1]"\&..PPTo determine whether the hostname was successfully resolved, the \fBne_addr_result\fR function is used, which returns non\-zero if an error occurred\&. If an error did occur, the \fBne_addr_error\fR function can be used, which will copy the error string into a given \fIbuffer\fR (of size \fIbufsiz\fR)\&..PPThe functions \fBne_addr_first\fR and \fBne_addr_next\fR are used to retrieve the Internet addresses associated with an address object which has been successfully resolved\&. \fBne_addr_first\fR returns the first address; \fBne_addr_next\fR returns the next address after the most recent call to \fBne_addr_next\fR or \fBne_addr_first\fR, or NULL if there are no more addresses\&. The \fBne_inet_addr\fR pointer returned by these functions can be passed to \fBne_sock_connect\fR to connect a socket\&..PPAfter the address object has been used, it should be destroyed using \fBne_addr_destroy\fR\&..SH "RETURN VALUE".PP\fBne_addr_resolve\fR returns a pointer to an address object, and never NULL\&. \fBne_addr_error\fR returns the \fIbuffer\fR parameter \&..SH "EXAMPLES".PPThe code below prints out the set of addresses associated with the hostname www\&.google\&.com\&..nfne_sock_addr *addr;char buf[256];addr = ne_addr_resolve("www\&.google\&.com", 0);if (ne_addr_result(addr)) { printf("Could not resolve www\&.google\&.com: %s\\n", ne_addr_error(addr, buf, sizeof buf));} else { const ne_inet_addr *ia; printf("www\&.google\&.com:"); for (ia = ne_addr_first(addr); ia != NULL; ia = ne_addr_next(addr)) { printf(" %s", ne_iaddr_print(ia, buf, sizeof buf)); } putchar('\\n');}ne_addr_destroy(addr);.fi.SH "SEE ALSO".PP\fBne_iaddr_print\fR(3).SH AUTHORJoe Orton <neon@webdav\&.org>.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -