Subject: Wrong example in getaddrinfo(3)?
To: None <current-users@netbsd.org>
From: Olaf Seibert <rhialto@polderland.nl>
List: current-users
Date: 02/10/2001 15:30:06
I think I found a cut&paste error in getaddrinfo(3):
(in both 1.5 and -current)

EXAMPLES
...
     The following example tries to open wildcard listening socket onto ser-
     vice ``http'', for all the address families available.

...
           error = getaddrinfo(NULL, "http", &hints, &res0);
           for (res = res0; res && nsock < MAXSOCK; res = res->ai_next) {
                   s[nsock] = socket(res->ai_family, res->ai_socktype,
                       res->ai_protocol);
		   ...
                   if (connect(s[nsock], res->ai_addr, res->ai_addrlen) < 0) {
			cause = "connect";
			...
                   }

                   nsock++;
           }
           freeaddrinfo(res0);

Should connect() not be bind() here?

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert - rhialto@polder --Soep van de dag, wat zal dat zijn
\X/ land.nl     --wat kan dat wezen, beter maar het ergste vrezen -Boy Bensdorp