diff options
author | itojun <> | 2001-02-12 09:24:47 +0000 |
---|---|---|
committer | itojun <> | 2001-02-12 09:24:47 +0000 |
commit | 2a94113f788fe99372a5d44b064a53cd54cb43ec (patch) | |
tree | 7b25341c77f2d0578b09bdcf5316e0eaef09945a | |
parent | dc79732f66d2c42376d5133cd00d3af34a3bcfba (diff) | |
download | openbsd-2a94113f788fe99372a5d44b064a53cd54cb43ec.tar.gz openbsd-2a94113f788fe99372a5d44b064a53cd54cb43ec.tar.bz2 openbsd-2a94113f788fe99372a5d44b064a53cd54cb43ec.zip |
correct listener side example. from deraadt
-rw-r--r-- | src/lib/libc/net/getaddrinfo.3 | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/libc/net/getaddrinfo.3 b/src/lib/libc/net/getaddrinfo.3 index 28632dcee3..741b6d7197 100644 --- a/src/lib/libc/net/getaddrinfo.3 +++ b/src/lib/libc/net/getaddrinfo.3 | |||
@@ -1,5 +1,5 @@ | |||
1 | .\" $OpenBSD: getaddrinfo.3,v 1.14 2001/01/26 13:31:35 itojun Exp $ | 1 | .\" $OpenBSD: getaddrinfo.3,v 1.15 2001/02/12 09:24:47 itojun Exp $ |
2 | .\" $KAME: getaddrinfo.3,v 1.27 2001/01/26 13:27:56 itojun Exp $ | 2 | .\" $KAME: getaddrinfo.3,v 1.29 2001/02/12 09:24:45 itojun Exp $ |
3 | .\" | 3 | .\" |
4 | .\" Copyright (c) 1983, 1987, 1991, 1993 | 4 | .\" Copyright (c) 1983, 1987, 1991, 1993 |
5 | .\" The Regents of the University of California. All rights reserved. | 5 | .\" The Regents of the University of California. All rights reserved. |
@@ -434,7 +434,7 @@ if (s < 0) { | |||
434 | freeaddrinfo(res0); | 434 | freeaddrinfo(res0); |
435 | .Ed | 435 | .Ed |
436 | .Pp | 436 | .Pp |
437 | The following example tries to open wildcard listening socket onto service | 437 | The following example tries to open a wildcard listening socket onto service |
438 | .Dq Li http , | 438 | .Dq Li http , |
439 | for all the address families available. | 439 | for all the address families available. |
440 | .Bd -literal -offset indent | 440 | .Bd -literal -offset indent |
@@ -462,11 +462,12 @@ for (res = res0; res && nsock < MAXSOCK; res = res->ai_next) { | |||
462 | continue; | 462 | continue; |
463 | } | 463 | } |
464 | 464 | ||
465 | if (connect(s[nsock], res->ai_addr, res->ai_addrlen) < 0) { | 465 | if (bind(s[nsock], res->ai_addr, res->ai_addrlen) < 0) { |
466 | cause = "connect"; | 466 | cause = "bind"; |
467 | close(s[nsock]); | 467 | close(s[nsock]); |
468 | continue; | 468 | continue; |
469 | } | 469 | } |
470 | (void) listen(s[nsock], 5); | ||
470 | 471 | ||
471 | nsock++; | 472 | nsock++; |
472 | } | 473 | } |