Debian Codegraph @

templates/man3/getaddrinfo.3.pot

raw
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2026-06-05 06:25+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
21 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
22 #, no-wrap
23 msgid "getaddrinfo"
24 msgstr ""
25
26 #. type: TH
27 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
28 #: opensuse-tumbleweed
29 #, no-wrap
30 msgid "2026-02-08"
31 msgstr ""
32
33 #. type: TH
34 #: archlinux debian-unstable
35 #, no-wrap
36 msgid "Linux man-pages 6.18"
37 msgstr ""
38
39 #. type: SH
40 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
41 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
42 #, no-wrap
43 msgid "NAME"
44 msgstr ""
45
46 #. type: Plain text
47 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
48 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
49 msgid ""
50 "getaddrinfo, freeaddrinfo, gai_strerror - network address and service "
51 "translation"
52 msgstr ""
53
54 #. type: SH
55 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
56 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
57 #, no-wrap
58 msgid "LIBRARY"
59 msgstr ""
60
61 #. type: Plain text
62 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
63 #: opensuse-leap-16-1 opensuse-tumbleweed
64 msgid "Standard C library (I<libc>,\\ I<-lc>)"
65 msgstr ""
66
67 #. type: SH
68 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
69 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
70 #, no-wrap
71 msgid "SYNOPSIS"
72 msgstr ""
73
74 #. type: Plain text
75 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
76 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
77 #, no-wrap
78 msgid ""
79 "B<#include E<lt>sys/types.hE<gt>>\n"
80 "B<#include E<lt>sys/socket.hE<gt>>\n"
81 "B<#include E<lt>netdb.hE<gt>>\n"
82 msgstr ""
83
84 #. type: Plain text
85 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
86 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
87 #, no-wrap
88 msgid ""
89 "B<int getaddrinfo(const char *restrict >I<node>B<,>\n"
90 "B< const char *restrict >I<service>B<,>\n"
91 "B< const struct addrinfo *restrict >I<hints>B<,>\n"
92 "B< struct addrinfo **restrict >I<res>B<);>\n"
93 msgstr ""
94
95 #. type: Plain text
96 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
97 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
98 #, no-wrap
99 msgid "B<void freeaddrinfo(struct addrinfo *>I<res>B<);>\n"
100 msgstr ""
101
102 #. type: Plain text
103 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
104 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
105 #, no-wrap
106 msgid "B<const char *gai_strerror(int >I<errcode>B<);>\n"
107 msgstr ""
108
109 #. type: Plain text
110 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
111 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
112 msgid ""
113 "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
114 msgstr ""
115
116 #. type: Plain text
117 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
118 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
119 msgid "B<getaddrinfo>(), B<freeaddrinfo>(), B<gai_strerror>():"
120 msgstr ""
121
122 #. type: Plain text
123 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
124 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
125 #, no-wrap
126 msgid ""
127 " Since glibc 2.22:\n"
128 " _POSIX_C_SOURCE E<gt>= 200112L\n"
129 " glibc 2.21 and earlier:\n"
130 " _POSIX_C_SOURCE\n"
131 msgstr ""
132
133 #. type: SH
134 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
135 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
136 #, no-wrap
137 msgid "DESCRIPTION"
138 msgstr ""
139
140 #. .BR getipnodebyname (3),
141 #. .BR getipnodebyaddr (3),
142 #. type: Plain text
143 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
144 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
145 msgid ""
146 "Given I<node> and I<service>, which identify an Internet host and a service, "
147 "B<getaddrinfo>() returns one or more I<addrinfo> structures, each of which "
148 "contains an Internet address that can be specified in a call to B<bind>(2) "
149 "or B<connect>(2). The B<getaddrinfo>() function combines the functionality "
150 "provided by the B<gethostbyname>(3) and B<getservbyname>(3) functions into "
151 "a single interface, but unlike the latter functions, B<getaddrinfo>() is "
152 "reentrant and allows programs to eliminate IPv4-versus-IPv6 dependencies."
153 msgstr ""
154
155 #. type: Plain text
156 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
157 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
158 msgid ""
159 "The I<addrinfo> structure used by B<getaddrinfo>() contains the following "
160 "fields:"
161 msgstr ""
162
163 #. type: Plain text
164 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
165 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
166 #, no-wrap
167 msgid ""
168 "struct addrinfo {\n"
169 " int ai_flags;\n"
170 " int ai_family;\n"
171 " int ai_socktype;\n"
172 " int ai_protocol;\n"
173 " socklen_t ai_addrlen;\n"
174 " struct sockaddr *ai_addr;\n"
175 " char *ai_canonname;\n"
176 " struct addrinfo *ai_next;\n"
177 "};\n"
178 msgstr ""
179
180 #. type: Plain text
181 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
182 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
183 msgid ""
184 "The I<hints> argument points to an I<addrinfo> structure that specifies "
185 "criteria for selecting the socket address structures returned in the list "
186 "pointed to by I<res>. If I<hints> is not NULL it points to an I<addrinfo> "
187 "structure whose I<ai_family>, I<ai_socktype>, and I<ai_protocol> specify "
188 "criteria that limit the set of socket addresses returned by "
189 "B<getaddrinfo>(), as follows:"
190 msgstr ""
191
192 #. type: TP
193 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
194 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
195 #, no-wrap
196 msgid "I<ai_family>"
197 msgstr ""
198
199 #. type: Plain text
200 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
201 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
202 msgid ""
203 "This field specifies the desired address family for the returned addresses. "
204 "Valid values for this field include B<AF_INET> and B<AF_INET6>. The value "
205 "B<AF_UNSPEC> indicates that B<getaddrinfo>() should return socket addresses "
206 "for any address family (either IPv4 or IPv6, for example) that can be used "
207 "with I<node> and I<service>."
208 msgstr ""
209
210 #. type: TP
211 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
212 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
213 #, no-wrap
214 msgid "I<ai_socktype>"
215 msgstr ""
216
217 #. type: Plain text
218 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
219 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
220 msgid ""
221 "This field specifies the preferred socket type, for example B<SOCK_STREAM> "
222 "or B<SOCK_DGRAM>. Specifying 0 in this field indicates that socket "
223 "addresses of any type can be returned by B<getaddrinfo>()."
224 msgstr ""
225
226 #. type: TP
227 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
228 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
229 #, no-wrap
230 msgid "I<ai_protocol>"
231 msgstr ""
232
233 #. type: Plain text
234 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
235 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
236 msgid ""
237 "This field specifies the protocol for the returned socket addresses. "
238 "Specifying 0 in this field indicates that socket addresses with any protocol "
239 "can be returned by B<getaddrinfo>()."
240 msgstr ""
241
242 #. type: TP
243 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
244 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
245 #, no-wrap
246 msgid "I<ai_flags>"
247 msgstr ""
248
249 #. type: Plain text
250 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
251 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
252 msgid ""
253 "This field specifies additional options, described below. Multiple flags "
254 "are specified by bitwise OR-ing them together."
255 msgstr ""
256
257 #. type: Plain text
258 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
259 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
260 msgid ""
261 "All the other fields in the structure pointed to by I<hints> must contain "
262 "either 0 or a null pointer, as appropriate."
263 msgstr ""
264
265 #. type: Plain text
266 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
267 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
268 msgid ""
269 "Specifying I<hints> as NULL is equivalent to setting I<ai_socktype> and "
270 "I<ai_protocol> to 0; I<ai_family> to B<AF_UNSPEC>; and I<ai_flags> to "
271 "B<(AI_V4MAPPED\\ |\\ AI_ADDRCONFIG)>. (POSIX specifies different defaults "
272 "for I<ai_flags>; see NOTES.) I<node> specifies either a numerical network "
273 "address (for IPv4, numbers-and-dots notation as supported by "
274 "B<inet_aton>(3); for IPv6, hexadecimal string format as supported by "
275 "B<inet_pton>(3)), or a network hostname, whose network addresses are looked "
276 "up and resolved. If I<hints.ai_flags> contains the B<AI_NUMERICHOST> flag, "
277 "then I<node> must be a numerical network address. The B<AI_NUMERICHOST> "
278 "flag suppresses any potentially lengthy network host address lookups."
279 msgstr ""
280
281 #. type: Plain text
282 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
283 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
284 msgid ""
285 "If the B<AI_PASSIVE> flag is specified in I<hints.ai_flags>, and I<node> is "
286 "NULL, then the returned socket addresses will be suitable for B<bind>(2)ing "
287 "a socket that will B<accept>(2) connections. The returned socket address "
288 "will contain the \"wildcard address\" (B<INADDR_ANY> for IPv4 addresses, "
289 "B<IN6ADDR_ANY_INIT> for IPv6 address). The wildcard address is used by "
290 "applications (typically servers) that intend to accept connections on any "
291 "of the host's network addresses. If I<node> is not NULL, then the "
292 "B<AI_PASSIVE> flag is ignored."
293 msgstr ""
294
295 #. type: Plain text
296 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
297 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
298 msgid ""
299 "If the B<AI_PASSIVE> flag is not set in I<hints.ai_flags>, then the returned "
300 "socket addresses will be suitable for use with B<connect>(2), B<sendto>(2), "
301 "or B<sendmsg>(2). If I<node> is NULL, then the network address will be set "
302 "to the loopback interface address (B<INADDR_LOOPBACK> for IPv4 addresses, "
303 "B<IN6ADDR_LOOPBACK_INIT> for IPv6 address); this is used by applications "
304 "that intend to communicate with peers running on the same host."
305 msgstr ""
306
307 #. type: Plain text
308 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
309 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
310 msgid ""
311 "I<service> sets the port in each returned address structure. If this "
312 "argument is a service name (see B<services>(5)), it is translated to the "
313 "corresponding port number. This argument can also be specified as a decimal "
314 "number, which is simply converted to binary. If I<service> is NULL, then "
315 "the port number of the returned socket addresses will be left "
316 "uninitialized. If B<AI_NUMERICSERV> is specified in I<hints.ai_flags> and "
317 "I<service> is not NULL, then I<service> must point to a string containing a "
318 "numeric port number. This flag is used to inhibit the invocation of a name "
319 "resolution service in cases where it is known not to be required."
320 msgstr ""
321
322 #. type: Plain text
323 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
324 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
325 msgid "Either I<node> or I<service>, but not both, may be NULL."
326 msgstr ""
327
328 #. type: Plain text
329 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
330 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
331 msgid ""
332 "The B<getaddrinfo>() function allocates and initializes a linked list of "
333 "I<addrinfo> structures, one for each network address that matches I<node> "
334 "and I<service>, subject to any restrictions imposed by I<hints>, and returns "
335 "a pointer to the start of the list in I<res>. The items in the linked list "
336 "are linked by the I<ai_next> field."
337 msgstr ""
338
339 #. type: Plain text
340 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
341 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
342 msgid ""
343 "There are several reasons why the linked list may have more than one "
344 "I<addrinfo> structure, including: the network host is multihomed, accessible "
345 "over multiple protocols (e.g., both B<AF_INET> and B<AF_INET6>); or the same "
346 "service is available from multiple socket types (one B<SOCK_STREAM> address "
347 "and another B<SOCK_DGRAM> address, for example). Normally, the application "
348 "should try using the addresses in the order in which they are returned. The "
349 "sorting function used within B<getaddrinfo>() is defined in RFC\\ 3484; the "
350 "order can be tweaked for a particular system by editing I</etc/gai.conf> "
351 "(available since glibc 2.5)."
352 msgstr ""
353
354 #. Prior to glibc 2.3.4, the ai_canonname of each addrinfo
355 #. structure was set pointing to the canonical name; that was
356 #. more than POSIX.1-2001 specified, or other implementations provided.
357 #. MTK, Aug 05
358 #. type: Plain text
359 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
360 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
361 msgid ""
362 "If I<hints.ai_flags> includes the B<AI_CANONNAME> flag, then the "
363 "I<ai_canonname> field of the first of the I<addrinfo> structures in the "
364 "returned list is set to point to the official name of the host."
365 msgstr ""
366
367 #. type: Plain text
368 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
369 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
370 msgid ""
371 "The remaining fields of each returned I<addrinfo> structure are initialized "
372 "as follows:"
373 msgstr ""
374
375 #. type: IP
376 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
377 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
378 #, no-wrap
379 msgid "\\[bu]"
380 msgstr ""
381
382 #. type: Plain text
383 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
384 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
385 msgid ""
386 "The I<ai_family>, I<ai_socktype>, and I<ai_protocol> fields return the "
387 "socket creation parameters (i.e., these fields have the same meaning as the "
388 "corresponding arguments of B<socket>(2)). For example, I<ai_family> might "
389 "return B<AF_INET> or B<AF_INET6>; I<ai_socktype> might return B<SOCK_DGRAM> "
390 "or B<SOCK_STREAM>; and I<ai_protocol> returns the protocol for the socket."
391 msgstr ""
392
393 #. type: Plain text
394 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
395 #: opensuse-leap-16-1 opensuse-tumbleweed
396 msgid ""
397 "A pointer to the socket address is placed in the I<ai_addr> field, and the "
398 "size of the socket address, in bytes, is placed in the I<ai_addrlen> field."
399 msgstr ""
400
401 #. type: Plain text
402 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
403 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
404 msgid ""
405 "If I<hints.ai_flags> includes the B<AI_ADDRCONFIG> flag, then IPv4 addresses "
406 "are returned in the list pointed to by I<res> only if the local system has "
407 "at least one IPv4 address configured, and IPv6 addresses are returned only "
408 "if the local system has at least one IPv6 address configured. The loopback "
409 "address is not considered for this case as valid as a configured address. "
410 "This flag is useful on, for example, IPv4-only systems, to ensure that "
411 "B<getaddrinfo>() does not return IPv6 socket addresses that would always "
412 "fail in B<connect>(2) or B<bind>(2)."
413 msgstr ""
414
415 #. type: Plain text
416 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
417 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
418 msgid ""
419 "If I<hints.ai_flags> specifies the B<AI_V4MAPPED> flag, and "
420 "I<hints.ai_family> was specified as B<AF_INET6>, and no matching IPv6 "
421 "addresses could be found, then return IPv4-mapped IPv6 addresses in the list "
422 "pointed to by I<res>. If both B<AI_V4MAPPED> and B<AI_ALL> are specified in "
423 "I<hints.ai_flags>, then return both IPv6 and IPv4-mapped IPv6 addresses in "
424 "the list pointed to by I<res>. B<AI_ALL> is ignored if B<AI_V4MAPPED> is "
425 "not also specified."
426 msgstr ""
427
428 #. type: Plain text
429 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
430 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
431 msgid ""
432 "The B<freeaddrinfo>() function frees the memory that was allocated for the "
433 "dynamically allocated linked list I<res>."
434 msgstr ""
435
436 #. type: SS
437 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
438 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
439 #, no-wrap
440 msgid "Extensions to getaddrinfo() for Internationalized Domain Names"
441 msgstr ""
442
443 #. type: Plain text
444 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
445 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
446 msgid ""
447 "Starting with glibc 2.3.4, B<getaddrinfo>() has been extended to "
448 "selectively allow the incoming and outgoing hostnames to be transparently "
449 "converted to and from the Internationalized Domain Name (IDN) format (see "
450 "RFC 3490, I<Internationalizing Domain Names in Applications (IDNA)>). Four "
451 "new flags are defined:"
452 msgstr ""
453
454 #. type: TP
455 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
456 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
457 #, no-wrap
458 msgid "B<AI_IDN>"
459 msgstr ""
460
461 #. type: Plain text
462 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
463 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
464 msgid ""
465 "If this flag is specified, then the node name given in I<node> is converted "
466 "to IDN format if necessary. The source encoding is that of the current "
467 "locale."
468 msgstr ""
469
470 #. Implementation Detail:
471 #. To minimize effects on system performance the implementation might
472 #. want to check whether the input string contains any non-ASCII
473 #. characters. If there are none the IDN step can be skipped completely.
474 #. On systems which allow not-ASCII safe encodings for a locale this
475 #. might be a problem.
476 #. type: Plain text
477 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
478 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
479 msgid ""
480 "If the input name contains non-ASCII characters, then the IDN encoding is "
481 "used. Those parts of the node name (delimited by dots) that contain non-"
482 "ASCII characters are encoded using ASCII Compatible Encoding (ACE) before "
483 "being passed to the name resolution functions."
484 msgstr ""
485
486 #. type: TP
487 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
488 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
489 #, no-wrap
490 msgid "B<AI_CANONIDN>"
491 msgstr ""
492
493 #. type: Plain text
494 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
495 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
496 msgid ""
497 "After a successful name lookup, and if the B<AI_CANONNAME> flag was "
498 "specified, B<getaddrinfo>() will return the canonical name of the node "
499 "corresponding to the I<addrinfo> structure value passed back. The return "
500 "value is an exact copy of the value returned by the name resolution function."
501 msgstr ""
502
503 #
504 #. Implementation Detail:
505 #. If no component of the returned name starts with xn\-\- the IDN
506 #. step can be skipped, therefore avoiding unnecessary slowdowns.
507 #. type: Plain text
508 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
509 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
510 msgid ""
511 "If the name is encoded using ACE, then it will contain the I<xn--> prefix "
512 "for one or more components of the name. To convert these components into a "
513 "readable form the B<AI_CANONIDN> flag can be passed in addition to "
514 "B<AI_CANONNAME>. The resulting string is encoded using the current locale's "
515 "encoding."
516 msgstr ""
517
518 #. type: TP
519 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
520 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
521 #, no-wrap
522 msgid "B<AI_IDN_ALLOW_UNASSIGNED>"
523 msgstr ""
524
525 #. type: TQ
526 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
527 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
528 #, no-wrap
529 msgid "B<AI_IDN_USE_STD3_ASCII_RULES>"
530 msgstr ""
531
532 #. type: Plain text
533 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
534 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
535 msgid ""
536 "Setting these flags will enable the IDNA_ALLOW_UNASSIGNED (allow unassigned "
537 "Unicode code points) and IDNA_USE_STD3_ASCII_RULES (check output to make "
538 "sure it is a STD3 conforming hostname) flags respectively to be used in the "
539 "IDNA handling."
540 msgstr ""
541
542 #. type: SH
543 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
544 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
545 #, no-wrap
546 msgid "RETURN VALUE"
547 msgstr ""
548
549 #. FIXME glibc defines the following additional errors, some which
550 #. can probably be returned by getaddrinfo(); they need to
551 #. be documented.
552 #. #ifdef __USE_GNU
553 #. #define EAI_INPROGRESS -100 /* Processing request in progress. */
554 #. #define EAI_CANCELED -101 /* Request canceled. */
555 #. #define EAI_NOTCANCELED -102 /* Request not canceled. */
556 #. #define EAI_ALLDONE -103 /* All requests done. */
557 #. #define EAI_INTR -104 /* Interrupted by a signal. */
558 #. #define EAI_IDN_ENCODE -105 /* IDN encoding failed. */
559 #. #endif
560 #. type: Plain text
561 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
562 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
563 msgid ""
564 "B<getaddrinfo>() returns 0 if it succeeds, or one of the following nonzero "
565 "error codes:"
566 msgstr ""
567
568 #. type: TP
569 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
570 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
571 #, no-wrap
572 msgid "B<EAI_ADDRFAMILY>"
573 msgstr ""
574
575 #. Not in SUSv3
576 #. type: Plain text
577 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
578 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
579 msgid ""
580 "The specified network host does not have any network addresses in the "
581 "requested address family."
582 msgstr ""
583
584 #. type: TP
585 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
586 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
587 #, no-wrap
588 msgid "B<EAI_AGAIN>"
589 msgstr ""
590
591 #. type: Plain text
592 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
593 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
594 msgid ""
595 "The name server returned a temporary failure indication. Try again later."
596 msgstr ""
597
598 #. type: TP
599 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
600 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
601 #, no-wrap
602 msgid "B<EAI_BADFLAGS>"
603 msgstr ""
604
605 #. type: Plain text
606 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
607 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
608 msgid ""
609 "I<hints.ai_flags> contains invalid flags; or, I<hints.ai_flags> included "
610 "B<AI_CANONNAME> and I<node> was NULL."
611 msgstr ""
612
613 #. type: TP
614 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
615 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
616 #, no-wrap
617 msgid "B<EAI_FAIL>"
618 msgstr ""
619
620 #. type: Plain text
621 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
622 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
623 msgid "The name server returned a permanent failure indication."
624 msgstr ""
625
626 #. type: TP
627 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
628 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
629 #, no-wrap
630 msgid "B<EAI_FAMILY>"
631 msgstr ""
632
633 #. type: Plain text
634 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
635 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
636 msgid "The requested address family is not supported."
637 msgstr ""
638
639 #. type: TP
640 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
641 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
642 #, no-wrap
643 msgid "B<EAI_MEMORY>"
644 msgstr ""
645
646 #. type: Plain text
647 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
648 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
649 msgid "Out of memory."
650 msgstr ""
651
652 #. type: TP
653 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
654 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
655 #, no-wrap
656 msgid "B<EAI_NODATA>"
657 msgstr ""
658
659 #. Not in SUSv3
660 #. type: Plain text
661 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
662 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
663 msgid ""
664 "The specified network host exists, but does not have any network addresses "
665 "defined."
666 msgstr ""
667
668 #. type: TP
669 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
670 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
671 #, no-wrap
672 msgid "B<EAI_NONAME>"
673 msgstr ""
674
675 #. type: Plain text
676 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
677 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
678 msgid ""
679 "The I<node> or I<service> is not known; or both I<node> and I<service> are "
680 "NULL; or B<AI_NUMERICSERV> was specified in I<hints.ai_flags> and I<service> "
681 "was not a numeric port-number string."
682 msgstr ""
683
684 #. type: TP
685 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
686 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
687 #, no-wrap
688 msgid "B<EAI_SERVICE>"
689 msgstr ""
690
691 #. type: Plain text
692 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
693 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
694 msgid ""
695 "The requested service is not available for the requested socket type. It "
696 "may be available through another socket type. For example, this error could "
697 "occur if I<service> was \"shell\" (a service available only on stream "
698 "sockets), and either I<hints.ai_protocol> was B<IPPROTO_UDP>, or "
699 "I<hints.ai_socktype> was B<SOCK_DGRAM>; or the error could occur if "
700 "I<service> was not NULL, and I<hints.ai_socktype> was B<SOCK_RAW> (a socket "
701 "type that does not support the concept of services)."
702 msgstr ""
703
704 #. type: TP
705 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
706 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
707 #, no-wrap
708 msgid "B<EAI_SOCKTYPE>"
709 msgstr ""
710
711 #. type: Plain text
712 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
713 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
714 msgid ""
715 "The requested socket type is not supported. This could occur, for example, "
716 "if I<hints.ai_socktype> and I<hints.ai_protocol> are inconsistent (e.g., "
717 "B<SOCK_DGRAM> and B<IPPROTO_TCP>, respectively)."
718 msgstr ""
719
720 #. type: TP
721 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
722 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
723 #, no-wrap
724 msgid "B<EAI_SYSTEM>"
725 msgstr ""
726
727 #. type: Plain text
728 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
729 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
730 msgid "Other system error; I<errno> is set to indicate the error."
731 msgstr ""
732
733 #. type: Plain text
734 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
735 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
736 msgid ""
737 "The B<gai_strerror>() function translates these error codes to a human "
738 "readable string, suitable for error reporting."
739 msgstr ""
740
741 #. type: SH
742 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
743 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
744 #, no-wrap
745 msgid "FILES"
746 msgstr ""
747
748 #. type: Plain text
749 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
750 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
751 msgid "I</etc/gai.conf>"
752 msgstr ""
753
754 #. type: SH
755 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
756 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
757 #, no-wrap
758 msgid "ATTRIBUTES"
759 msgstr ""
760
761 #. type: Plain text
762 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
763 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
764 msgid ""
765 "For an explanation of the terms used in this section, see B<attributes>(7)."
766 msgstr ""
767
768 #. type: tbl table
769 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
770 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
771 #, no-wrap
772 msgid "Interface"
773 msgstr ""
774
775 #. type: tbl table
776 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
777 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
778 #, no-wrap
779 msgid "Attribute"
780 msgstr ""
781
782 #. type: tbl table
783 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
784 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
785 #, no-wrap
786 msgid "Value"
787 msgstr ""
788
789 #. type: tbl table
790 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
791 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
792 #, no-wrap
793 msgid ".na\n"
794 msgstr ""
795
796 #. type: tbl table
797 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
798 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
799 #, no-wrap
800 msgid ".nh\n"
801 msgstr ""
802
803 #. type: TP
804 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
805 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
806 #, no-wrap
807 msgid "B<getaddrinfo>()"
808 msgstr ""
809
810 #. type: tbl table
811 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
812 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
813 #, no-wrap
814 msgid "Thread safety"
815 msgstr ""
816
817 #. type: tbl table
818 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
819 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
820 #, no-wrap
821 msgid "MT-Safe env locale"
822 msgstr ""
823
824 #. type: tbl table
825 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
826 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
827 #, no-wrap
828 msgid ""
829 "B<freeaddrinfo>(),\n"
830 "B<gai_strerror>()"
831 msgstr ""
832
833 #. type: tbl table
834 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
835 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
836 #, no-wrap
837 msgid "MT-Safe"
838 msgstr ""
839
840 #. type: SH
841 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
842 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
843 #, no-wrap
844 msgid "VERSIONS"
845 msgstr ""
846
847 #. POSIX.1-2001, POSIX.1-2008
848 #. type: Plain text
849 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
850 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
851 msgid ""
852 "According to POSIX.1, specifying I<hints> as NULL should cause I<ai_flags> "
853 "to be assumed as 0. The GNU C library instead assumes a value of "
854 "B<(AI_V4MAPPED\\ |\\ AI_ADDRCONFIG)> for this case, since this value is "
855 "considered an improvement on the specification."
856 msgstr ""
857
858 #. type: SH
859 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
860 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
861 #, no-wrap
862 msgid "STANDARDS"
863 msgstr ""
864
865 #. type: Plain text
866 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
867 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
868 msgid "POSIX.1-2008."
869 msgstr ""
870
871 #. type: Plain text
872 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
873 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
874 msgid "RFC\\ 2553."
875 msgstr ""
876
877 #. type: SH
878 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
879 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
880 #, no-wrap
881 msgid "HISTORY"
882 msgstr ""
883
884 #. type: Plain text
885 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
886 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
887 msgid "POSIX.1-2001."
888 msgstr ""
889
890 #. type: TP
891 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
892 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
893 #, no-wrap
894 msgid "B<AI_ADDRCONFIG>"
895 msgstr ""
896
897 #. type: TQ
898 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
899 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
900 #, no-wrap
901 msgid "B<AI_ALL>"
902 msgstr ""
903
904 #. type: TQ
905 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
906 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
907 #, no-wrap
908 msgid "B<AI_V4MAPPED>"
909 msgstr ""
910
911 #. type: Plain text
912 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
913 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
914 msgid "glibc 2.3.3."
915 msgstr ""
916
917 #. type: TP
918 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
919 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
920 #, no-wrap
921 msgid "B<AI_NUMERICSERV>"
922 msgstr ""
923
924 #. type: Plain text
925 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
926 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
927 msgid "glibc 2.3.4."
928 msgstr ""
929
930 #. type: SH
931 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
932 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
933 #, no-wrap
934 msgid "NOTES"
935 msgstr ""
936
937 #. type: Plain text
938 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
939 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
940 msgid ""
941 "B<getaddrinfo>() supports the I<address>B<%>I<scope-id> notation for "
942 "specifying the IPv6 scope-ID."
943 msgstr ""
944
945 #. type: SH
946 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
947 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
948 #, no-wrap
949 msgid "EXAMPLES"
950 msgstr ""
951
952 #. getnameinfo.3 refers to this example
953 #. socket.2 refers to this example
954 #. bind.2 refers to this example
955 #. connect.2 refers to this example
956 #. recvfrom.2 refers to this example
957 #. sendto.2 refers to this example
958 #. type: Plain text
959 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
960 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
961 msgid ""
962 "The following programs demonstrate the use of B<getaddrinfo>(), "
963 "B<gai_strerror>(), B<freeaddrinfo>(), and B<getnameinfo>(3). The programs "
964 "are an echo server and client for UDP datagrams."
965 msgstr ""
966
967 #. type: SS
968 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
969 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
970 #, no-wrap
971 msgid "Server program"
972 msgstr ""
973
974 #. type: Plain text
975 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
976 #: opensuse-tumbleweed
977 #, no-wrap
978 msgid ""
979 "#include E<lt>netdb.hE<gt>\n"
980 "#include E<lt>stdio.hE<gt>\n"
981 "#include E<lt>stdlib.hE<gt>\n"
982 "#include E<lt>string.hE<gt>\n"
983 "#include E<lt>sys/socket.hE<gt>\n"
984 "#include E<lt>sys/types.hE<gt>\n"
985 "#include E<lt>unistd.hE<gt>\n"
986 "\\&\n"
987 "#define BUF_SIZE 500\n"
988 "\\&\n"
989 "int\n"
990 "main(int argc, char *argv[])\n"
991 "{\n"
992 " int sfd, s;\n"
993 " char buf[BUF_SIZE];\n"
994 " ssize_t nread;\n"
995 " socklen_t peer_addrlen;\n"
996 " struct addrinfo hints;\n"
997 " struct addrinfo *result, *rp;\n"
998 " struct sockaddr_storage peer_addr;\n"
999 "\\&\n"
1000 " if (argc != 2) {\n"
1001 " fprintf(stderr, \"Usage: %s port\\[rs]n\", argv[0]);\n"
1002 " exit(EXIT_FAILURE);\n"
1003 " }\n"
1004 "\\&\n"
1005 " memset(&hints, 0, sizeof(hints));\n"
1006 " hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */\n"
1007 " hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */\n"
1008 " hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */\n"
1009 " hints.ai_protocol = 0; /* Any protocol */\n"
1010 " hints.ai_canonname = NULL;\n"
1011 " hints.ai_addr = NULL;\n"
1012 " hints.ai_next = NULL;\n"
1013 "\\&\n"
1014 " s = getaddrinfo(NULL, argv[1], &hints, &result);\n"
1015 " if (s != 0) {\n"
1016 " fprintf(stderr, \"getaddrinfo: %s\\[rs]n\", gai_strerror(s));\n"
1017 " exit(EXIT_FAILURE);\n"
1018 " }\n"
1019 "\\&\n"
1020 " /* getaddrinfo() returns a list of address structures.\n"
1021 " Try each address until we successfully bind(2).\n"
1022 " If socket(2) (or bind(2)) fails, we (close the socket\n"
1023 " and) try the next address. */\n"
1024 "\\&\n"
1025 " for (rp = result; rp != NULL; rp = rp-E<gt>ai_next) {\n"
1026 " sfd = socket(rp-E<gt>ai_family, rp-E<gt>ai_socktype,\n"
1027 " rp-E<gt>ai_protocol);\n"
1028 " if (sfd == -1)\n"
1029 " continue;\n"
1030 "\\&\n"
1031 " if (bind(sfd, rp-E<gt>ai_addr, rp-E<gt>ai_addrlen) == 0)\n"
1032 " break; /* Success */\n"
1033 "\\&\n"
1034 " close(sfd);\n"
1035 " }\n"
1036 "\\&\n"
1037 " freeaddrinfo(result); /* No longer needed */\n"
1038 "\\&\n"
1039 " if (rp == NULL) { /* No address succeeded */\n"
1040 " fprintf(stderr, \"Could not bind\\[rs]n\");\n"
1041 " exit(EXIT_FAILURE);\n"
1042 " }\n"
1043 "\\&\n"
1044 " /* Read datagrams and echo them back to sender. */\n"
1045 "\\&\n"
1046 " for (;;) {\n"
1047 " char host[NI_MAXHOST], service[NI_MAXSERV];\n"
1048 "\\&\n"
1049 " peer_addrlen = sizeof(peer_addr);\n"
1050 " nread = recvfrom(sfd, buf, BUF_SIZE, 0,\n"
1051 " (struct sockaddr *) &peer_addr, &peer_addrlen);\n"
1052 " if (nread == -1)\n"
1053 " continue; /* Ignore failed request */\n"
1054 "\\&\n"
1055 " s = getnameinfo((struct sockaddr *) &peer_addr,\n"
1056 " peer_addrlen, host, NI_MAXHOST,\n"
1057 " service, NI_MAXSERV, NI_NUMERICSERV);\n"
1058 " if (s == 0)\n"
1059 " printf(\"Received %zd bytes from %s:%s\\[rs]n\",\n"
1060 " nread, host, service);\n"
1061 " else\n"
1062 " fprintf(stderr, \"getnameinfo: %s\\[rs]n\", gai_strerror(s));\n"
1063 "\\&\n"
1064 " if (sendto(sfd, buf, nread, 0, (struct sockaddr *) &peer_addr,\n"
1065 " peer_addrlen) != nread)\n"
1066 " {\n"
1067 " fprintf(stderr, \"Error sending response\\[rs]n\");\n"
1068 " }\n"
1069 " }\n"
1070 "}\n"
1071 msgstr ""
1072
1073 #. SRC END
1074 #. type: SS
1075 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1076 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1077 #, no-wrap
1078 msgid "Client program"
1079 msgstr ""
1080
1081 #. type: Plain text
1082 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1083 #: opensuse-tumbleweed
1084 #, no-wrap
1085 msgid ""
1086 "#include E<lt>netdb.hE<gt>\n"
1087 "#include E<lt>stdio.hE<gt>\n"
1088 "#include E<lt>stdlib.hE<gt>\n"
1089 "#include E<lt>string.hE<gt>\n"
1090 "#include E<lt>sys/socket.hE<gt>\n"
1091 "#include E<lt>sys/types.hE<gt>\n"
1092 "#include E<lt>unistd.hE<gt>\n"
1093 "\\&\n"
1094 "#define BUF_SIZE 500\n"
1095 "\\&\n"
1096 "int\n"
1097 "main(int argc, char *argv[])\n"
1098 "{\n"
1099 " int sfd, s;\n"
1100 " char buf[BUF_SIZE];\n"
1101 " size_t size;\n"
1102 " ssize_t nread;\n"
1103 " struct addrinfo hints;\n"
1104 " struct addrinfo *result, *rp;\n"
1105 "\\&\n"
1106 " if (argc E<lt> 3) {\n"
1107 " fprintf(stderr, \"Usage: %s host port msg...\\[rs]n\", argv[0]);\n"
1108 " exit(EXIT_FAILURE);\n"
1109 " }\n"
1110 "\\&\n"
1111 " /* Obtain address(es) matching host/port. */\n"
1112 "\\&\n"
1113 " memset(&hints, 0, sizeof(hints));\n"
1114 " hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */\n"
1115 " hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */\n"
1116 " hints.ai_flags = 0;\n"
1117 " hints.ai_protocol = 0; /* Any protocol */\n"
1118 "\\&\n"
1119 " s = getaddrinfo(argv[1], argv[2], &hints, &result);\n"
1120 " if (s != 0) {\n"
1121 " fprintf(stderr, \"getaddrinfo: %s\\[rs]n\", gai_strerror(s));\n"
1122 " exit(EXIT_FAILURE);\n"
1123 " }\n"
1124 "\\&\n"
1125 " /* getaddrinfo() returns a list of address structures.\n"
1126 " Try each address until we successfully connect(2).\n"
1127 " If socket(2) (or connect(2)) fails, we (close the socket\n"
1128 " and) try the next address. */\n"
1129 "\\&\n"
1130 " for (rp = result; rp != NULL; rp = rp-E<gt>ai_next) {\n"
1131 " sfd = socket(rp-E<gt>ai_family, rp-E<gt>ai_socktype,\n"
1132 " rp-E<gt>ai_protocol);\n"
1133 " if (sfd == -1)\n"
1134 " continue;\n"
1135 "\\&\n"
1136 " if (connect(sfd, rp-E<gt>ai_addr, rp-E<gt>ai_addrlen) != -1)\n"
1137 " break; /* Success */\n"
1138 "\\&\n"
1139 " close(sfd);\n"
1140 " }\n"
1141 "\\&\n"
1142 " freeaddrinfo(result); /* No longer needed */\n"
1143 "\\&\n"
1144 " if (rp == NULL) { /* No address succeeded */\n"
1145 " fprintf(stderr, \"Could not connect\\[rs]n\");\n"
1146 " exit(EXIT_FAILURE);\n"
1147 " }\n"
1148 "\\&\n"
1149 " /* Send remaining command-line arguments as separate\n"
1150 " datagrams, and read responses from server. */\n"
1151 "\\&\n"
1152 " for (size_t j = 3; j E<lt> argc; j++) {\n"
1153 " size = strlen(argv[j]) + 1;\n"
1154 " /* +1 for terminating null byte */\n"
1155 "\\&\n"
1156 " if (size E<gt> BUF_SIZE) {\n"
1157 " fprintf(stderr,\n"
1158 " \"Ignoring long message in argument %zu\\[rs]n\", j);\n"
1159 " continue;\n"
1160 " }\n"
1161 "\\&\n"
1162 " if (write(sfd, argv[j], size) != size) {\n"
1163 " fprintf(stderr, \"partial/failed write\\[rs]n\");\n"
1164 " exit(EXIT_FAILURE);\n"
1165 " }\n"
1166 "\\&\n"
1167 " nread = read(sfd, buf, BUF_SIZE);\n"
1168 " if (nread == -1) {\n"
1169 " perror(\"read\");\n"
1170 " exit(EXIT_FAILURE);\n"
1171 " }\n"
1172 "\\&\n"
1173 " printf(\"Received %zd bytes: %s\\[rs]n\", nread, buf);\n"
1174 " }\n"
1175 "\\&\n"
1176 " exit(EXIT_SUCCESS);\n"
1177 "}\n"
1178 msgstr ""
1179
1180 #. SRC END
1181 #. type: SH
1182 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1183 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1184 #, no-wrap
1185 msgid "SEE ALSO"
1186 msgstr ""
1187
1188 #. .BR getipnodebyaddr (3),
1189 #. .BR getipnodebyname (3),
1190 #. type: Plain text
1191 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1192 #: mageia-cauldron
1193 msgid ""
1194 "B<getaddrinfo_a>(3), B<gethostbyname>(3), B<getnameinfo>(3), B<inet>(3), "
1195 "B<gai.conf>(5), B<hostname>(7), B<ip>(7)"
1196 msgstr ""
1197
1198 #. type: TH
1199 #: debian-trixie
1200 #, no-wrap
1201 msgid "2024-06-15"
1202 msgstr ""
1203
1204 #. type: TH
1205 #: debian-trixie
1206 #, no-wrap
1207 msgid "Linux man-pages 6.9.1"
1208 msgstr ""
1209
1210 #. type: Plain text
1211 #: debian-trixie
1212 msgid "Standard C library (I<libc>, I<-lc>)"
1213 msgstr ""
1214
1215 #. type: Plain text
1216 #: debian-trixie
1217 msgid ""
1218 "A pointer to the socket address is placed in the I<ai_addr> field, and the "
1219 "length of the socket address, in bytes, is placed in the I<ai_addrlen> field."
1220 msgstr ""
1221
1222 #. type: Plain text
1223 #: debian-trixie fedora-44 fedora-rawhide
1224 #, no-wrap
1225 msgid ""
1226 "#include E<lt>netdb.hE<gt>\n"
1227 "#include E<lt>stdio.hE<gt>\n"
1228 "#include E<lt>stdlib.hE<gt>\n"
1229 "#include E<lt>string.hE<gt>\n"
1230 "#include E<lt>sys/socket.hE<gt>\n"
1231 "#include E<lt>sys/types.hE<gt>\n"
1232 "#include E<lt>unistd.hE<gt>\n"
1233 "\\&\n"
1234 "#define BUF_SIZE 500\n"
1235 "\\&\n"
1236 "int\n"
1237 "main(int argc, char *argv[])\n"
1238 "{\n"
1239 " int sfd, s;\n"
1240 " char buf[BUF_SIZE];\n"
1241 " ssize_t nread;\n"
1242 " socklen_t peer_addrlen;\n"
1243 " struct addrinfo hints;\n"
1244 " struct addrinfo *result, *rp;\n"
1245 " struct sockaddr_storage peer_addr;\n"
1246 "\\&\n"
1247 " if (argc != 2) {\n"
1248 " fprintf(stderr, \"Usage: %s port\\[rs]n\", argv[0]);\n"
1249 " exit(EXIT_FAILURE);\n"
1250 " }\n"
1251 "\\&\n"
1252 " memset(&hints, 0, sizeof(hints));\n"
1253 " hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */\n"
1254 " hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */\n"
1255 " hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */\n"
1256 " hints.ai_protocol = 0; /* Any protocol */\n"
1257 " hints.ai_canonname = NULL;\n"
1258 " hints.ai_addr = NULL;\n"
1259 " hints.ai_next = NULL;\n"
1260 "\\&\n"
1261 " s = getaddrinfo(NULL, argv[1], &hints, &result);\n"
1262 " if (s != 0) {\n"
1263 " fprintf(stderr, \"getaddrinfo: %s\\[rs]n\", gai_strerror(s));\n"
1264 " exit(EXIT_FAILURE);\n"
1265 " }\n"
1266 "\\&\n"
1267 " /* getaddrinfo() returns a list of address structures.\n"
1268 " Try each address until we successfully bind(2).\n"
1269 " If socket(2) (or bind(2)) fails, we (close the socket\n"
1270 " and) try the next address. */\n"
1271 "\\&\n"
1272 " for (rp = result; rp != NULL; rp = rp-E<gt>ai_next) {\n"
1273 " sfd = socket(rp-E<gt>ai_family, rp-E<gt>ai_socktype,\n"
1274 " rp-E<gt>ai_protocol);\n"
1275 " if (sfd == -1)\n"
1276 " continue;\n"
1277 "\\&\n"
1278 " if (bind(sfd, rp-E<gt>ai_addr, rp-E<gt>ai_addrlen) == 0)\n"
1279 " break; /* Success */\n"
1280 "\\&\n"
1281 " close(sfd);\n"
1282 " }\n"
1283 "\\&\n"
1284 " freeaddrinfo(result); /* No longer needed */\n"
1285 "\\&\n"
1286 " if (rp == NULL) { /* No address succeeded */\n"
1287 " fprintf(stderr, \"Could not bind\\[rs]n\");\n"
1288 " exit(EXIT_FAILURE);\n"
1289 " }\n"
1290 "\\&\n"
1291 " /* Read datagrams and echo them back to sender. */\n"
1292 "\\&\n"
1293 " for (;;) {\n"
1294 " char host[NI_MAXHOST], service[NI_MAXSERV];\n"
1295 "\\&\n"
1296 " peer_addrlen = sizeof(peer_addr);\n"
1297 " nread = recvfrom(sfd, buf, BUF_SIZE, 0,\n"
1298 " (struct sockaddr *) &peer_addr, &peer_addrlen);\n"
1299 " if (nread == -1)\n"
1300 " continue; /* Ignore failed request */\n"
1301 "\\&\n"
1302 " s = getnameinfo((struct sockaddr *) &peer_addr,\n"
1303 " peer_addrlen, host, NI_MAXHOST,\n"
1304 " service, NI_MAXSERV, NI_NUMERICSERV);\n"
1305 " if (s == 0)\n"
1306 " printf(\"Received %zd bytes from %s:%s\\[rs]n\",\n"
1307 " nread, host, service);\n"
1308 " else\n"
1309 " fprintf(stderr, \"getnameinfo: %s\\[rs]n\", gai_strerror(s));\n"
1310 "\\&\n"
1311 " if (sendto(sfd, buf, nread, 0, (struct sockaddr *) &peer_addr,\n"
1312 " peer_addrlen) != nread)\n"
1313 " {\n"
1314 " fprintf(stderr, \"Error sending response\\[rs]n\");\n"
1315 " }\n"
1316 " }\n"
1317 "}\n"
1318 msgstr ""
1319
1320 #. type: Plain text
1321 #: debian-trixie
1322 #, no-wrap
1323 msgid ""
1324 "#include E<lt>netdb.hE<gt>\n"
1325 "#include E<lt>stdio.hE<gt>\n"
1326 "#include E<lt>stdlib.hE<gt>\n"
1327 "#include E<lt>string.hE<gt>\n"
1328 "#include E<lt>sys/socket.hE<gt>\n"
1329 "#include E<lt>sys/types.hE<gt>\n"
1330 "#include E<lt>unistd.hE<gt>\n"
1331 "\\&\n"
1332 "#define BUF_SIZE 500\n"
1333 "\\&\n"
1334 "int\n"
1335 "main(int argc, char *argv[])\n"
1336 "{\n"
1337 " int sfd, s;\n"
1338 " char buf[BUF_SIZE];\n"
1339 " size_t len;\n"
1340 " ssize_t nread;\n"
1341 " struct addrinfo hints;\n"
1342 " struct addrinfo *result, *rp;\n"
1343 "\\&\n"
1344 " if (argc E<lt> 3) {\n"
1345 " fprintf(stderr, \"Usage: %s host port msg...\\[rs]n\", argv[0]);\n"
1346 " exit(EXIT_FAILURE);\n"
1347 " }\n"
1348 "\\&\n"
1349 " /* Obtain address(es) matching host/port. */\n"
1350 "\\&\n"
1351 " memset(&hints, 0, sizeof(hints));\n"
1352 " hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */\n"
1353 " hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */\n"
1354 " hints.ai_flags = 0;\n"
1355 " hints.ai_protocol = 0; /* Any protocol */\n"
1356 "\\&\n"
1357 " s = getaddrinfo(argv[1], argv[2], &hints, &result);\n"
1358 " if (s != 0) {\n"
1359 " fprintf(stderr, \"getaddrinfo: %s\\[rs]n\", gai_strerror(s));\n"
1360 " exit(EXIT_FAILURE);\n"
1361 " }\n"
1362 "\\&\n"
1363 " /* getaddrinfo() returns a list of address structures.\n"
1364 " Try each address until we successfully connect(2).\n"
1365 " If socket(2) (or connect(2)) fails, we (close the socket\n"
1366 " and) try the next address. */\n"
1367 "\\&\n"
1368 " for (rp = result; rp != NULL; rp = rp-E<gt>ai_next) {\n"
1369 " sfd = socket(rp-E<gt>ai_family, rp-E<gt>ai_socktype,\n"
1370 " rp-E<gt>ai_protocol);\n"
1371 " if (sfd == -1)\n"
1372 " continue;\n"
1373 "\\&\n"
1374 " if (connect(sfd, rp-E<gt>ai_addr, rp-E<gt>ai_addrlen) != -1)\n"
1375 " break; /* Success */\n"
1376 "\\&\n"
1377 " close(sfd);\n"
1378 " }\n"
1379 "\\&\n"
1380 " freeaddrinfo(result); /* No longer needed */\n"
1381 "\\&\n"
1382 " if (rp == NULL) { /* No address succeeded */\n"
1383 " fprintf(stderr, \"Could not connect\\[rs]n\");\n"
1384 " exit(EXIT_FAILURE);\n"
1385 " }\n"
1386 "\\&\n"
1387 " /* Send remaining command-line arguments as separate\n"
1388 " datagrams, and read responses from server. */\n"
1389 "\\&\n"
1390 " for (size_t j = 3; j E<lt> argc; j++) {\n"
1391 " len = strlen(argv[j]) + 1;\n"
1392 " /* +1 for terminating null byte */\n"
1393 "\\&\n"
1394 " if (len E<gt> BUF_SIZE) {\n"
1395 " fprintf(stderr,\n"
1396 " \"Ignoring long message in argument %zu\\[rs]n\", j);\n"
1397 " continue;\n"
1398 " }\n"
1399 "\\&\n"
1400 " if (write(sfd, argv[j], len) != len) {\n"
1401 " fprintf(stderr, \"partial/failed write\\[rs]n\");\n"
1402 " exit(EXIT_FAILURE);\n"
1403 " }\n"
1404 "\\&\n"
1405 " nread = read(sfd, buf, BUF_SIZE);\n"
1406 " if (nread == -1) {\n"
1407 " perror(\"read\");\n"
1408 " exit(EXIT_FAILURE);\n"
1409 " }\n"
1410 "\\&\n"
1411 " printf(\"Received %zd bytes: %s\\[rs]n\", nread, buf);\n"
1412 " }\n"
1413 "\\&\n"
1414 " exit(EXIT_SUCCESS);\n"
1415 "}\n"
1416 msgstr ""
1417
1418 #. type: TH
1419 #: fedora-44 fedora-rawhide
1420 #, no-wrap
1421 msgid "2024-11-17"
1422 msgstr ""
1423
1424 #. type: TH
1425 #: fedora-44 fedora-rawhide
1426 #, no-wrap
1427 msgid "Linux man-pages 6.13"
1428 msgstr ""
1429
1430 #. type: Plain text
1431 #: fedora-44 fedora-rawhide
1432 #, no-wrap
1433 msgid ""
1434 "#include E<lt>netdb.hE<gt>\n"
1435 "#include E<lt>stdio.hE<gt>\n"
1436 "#include E<lt>stdlib.hE<gt>\n"
1437 "#include E<lt>string.hE<gt>\n"
1438 "#include E<lt>sys/socket.hE<gt>\n"
1439 "#include E<lt>sys/types.hE<gt>\n"
1440 "#include E<lt>unistd.hE<gt>\n"
1441 "\\&\n"
1442 "#define BUF_SIZE 500\n"
1443 "\\&\n"
1444 "int\n"
1445 "main(int argc, char *argv[])\n"
1446 "{\n"
1447 " int sfd, s;\n"
1448 " char buf[BUF_SIZE];\n"
1449 " size_t size;\n"
1450 " ssize_t nread;\n"
1451 " struct addrinfo hints;\n"
1452 " struct addrinfo *result, *rp;\n"
1453 "\\&\n"
1454 " if (argc E<lt> 3) {\n"
1455 " fprintf(stderr, \"Usage: %s host port msg...\\[rs]n\", argv[0]);\n"
1456 " exit(EXIT_FAILURE);\n"
1457 " }\n"
1458 "\\&\n"
1459 " /* Obtain address(es) matching host/port. */\n"
1460 "\\&\n"
1461 " memset(&hints, 0, sizeof(hints));\n"
1462 " hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */\n"
1463 " hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */\n"
1464 " hints.ai_flags = 0;\n"
1465 " hints.ai_protocol = 0; /* Any protocol */\n"
1466 "\\&\n"
1467 " s = getaddrinfo(argv[1], argv[2], &hints, &result);\n"
1468 " if (s != 0) {\n"
1469 " fprintf(stderr, \"getaddrinfo: %s\\[rs]n\", gai_strerror(s));\n"
1470 " exit(EXIT_FAILURE);\n"
1471 " }\n"
1472 "\\&\n"
1473 " /* getaddrinfo() returns a list of address structures.\n"
1474 " Try each address until we successfully connect(2).\n"
1475 " If socket(2) (or connect(2)) fails, we (close the socket\n"
1476 " and) try the next address. */\n"
1477 "\\&\n"
1478 " for (rp = result; rp != NULL; rp = rp-E<gt>ai_next) {\n"
1479 " sfd = socket(rp-E<gt>ai_family, rp-E<gt>ai_socktype,\n"
1480 " rp-E<gt>ai_protocol);\n"
1481 " if (sfd == -1)\n"
1482 " continue;\n"
1483 "\\&\n"
1484 " if (connect(sfd, rp-E<gt>ai_addr, rp-E<gt>ai_addrlen) != -1)\n"
1485 " break; /* Success */\n"
1486 "\\&\n"
1487 " close(sfd);\n"
1488 " }\n"
1489 "\\&\n"
1490 " freeaddrinfo(result); /* No longer needed */\n"
1491 "\\&\n"
1492 " if (rp == NULL) { /* No address succeeded */\n"
1493 " fprintf(stderr, \"Could not connect\\[rs]n\");\n"
1494 " exit(EXIT_FAILURE);\n"
1495 " }\n"
1496 "\\&\n"
1497 " /* Send remaining command-line arguments as separate\n"
1498 " datagrams, and read responses from server. */\n"
1499 "\\&\n"
1500 " for (size_t j = 3; j E<lt> argc; j++) {\n"
1501 " size = strlen(argv[j]) + 1;\n"
1502 " /* +1 for terminating null byte */\n"
1503 "\\&\n"
1504 " if (size E<gt> BUF_SIZE) {\n"
1505 " fprintf(stderr,\n"
1506 " \"Ignoring long message in argument %zu\\[rs]n\", j);\n"
1507 " continue;\n"
1508 " }\n"
1509 "\\&\n"
1510 " if (write(sfd, argv[j], size) != size) {\n"
1511 " fprintf(stderr, \"partial/failed write\\[rs]n\");\n"
1512 " exit(EXIT_FAILURE);\n"
1513 " }\n"
1514 "\\&\n"
1515 " nread = read(sfd, buf, BUF_SIZE);\n"
1516 " if (nread == -1) {\n"
1517 " perror(\"read\");\n"
1518 " exit(EXIT_FAILURE);\n"
1519 " }\n"
1520 "\\&\n"
1521 " printf(\"Received %zd bytes: %s\\[rs]n\", nread, buf);\n"
1522 " }\n"
1523 "\\&\n"
1524 " exit(EXIT_SUCCESS);\n"
1525 "}\n"
1526 msgstr ""
1527
1528 #. type: TH
1529 #: mageia-cauldron
1530 #, no-wrap
1531 msgid "Linux man-pages 6.17"
1532 msgstr ""
1533
1534 #. type: TH
1535 #: opensuse-leap-16-1 opensuse-tumbleweed
1536 #, no-wrap
1537 msgid "Linux man-pages (unreleased)"
1538 msgstr ""
1539
1540 #. .BR getipnodebyaddr (3),
1541 #. .BR getipnodebyname (3),
1542 #. type: Plain text
1543 #: opensuse-leap-16-1 opensuse-tumbleweed
1544 msgid ""
1545 "B<getaddrinfo_a>(3), B<gethostbyname>(3), B<getnameinfo>(3), B<gai.conf>(5), "
1546 "B<inet>(3), B<gai.conf>(5), B<hostname>(7), B<ip>(7)"
1547 msgstr ""