Add a missing comma in OPENSSL_malloc.pod
[openssl.git] / doc / crypto / BIO_s_connect.pod
index 648e8ed42b7ef5b56b93baf5b835a5c8c7c78313..d97d5899a521fa0373db650bab478f3300b54f0c 100644 (file)
@@ -11,7 +11,7 @@ BIO_set_nbio, BIO_do_connect - connect BIO
 
  #include <openssl/bio.h>
 
- BIO_METHOD * BIO_s_connect(void);
const BIO_METHOD * BIO_s_connect(void);
 
  BIO *BIO_new_connect(char *name);
 
@@ -55,7 +55,7 @@ it also returns the socket . If B<c> is not NULL it should be of
 type (int *).
 
 BIO_set_conn_hostname() uses the string B<name> to set the hostname.
-The hostname can be an IP address; if the address is a IPv6 one, it
+The hostname can be an IP address; if the address is an IPv6 one, it
 must be enclosed with brackets. The hostname can also include the
 port in the form hostname:port.
 
@@ -81,7 +81,7 @@ This return value is an internal pointer which should not be modified.
 BIO_set_nbio() sets the non blocking I/O flag to B<n>. If B<n> is
 zero then blocking I/O is set. If B<n> is 1 then non blocking I/O
 is set. Blocking I/O is the default. The call to BIO_set_nbio()
-should be made before the connection is established because 
+should be made before the connection is established because
 non blocking I/O is set during the connect process.
 
 BIO_new_connect() combines BIO_new() and BIO_set_conn_hostname() into
@@ -164,19 +164,20 @@ to retrieve a page and copy the result to standard output.
  BIO *cbio, *out;
  int len;
  char tmpbuf[1024];
- ERR_load_crypto_strings();
+
  cbio = BIO_new_connect("localhost:http");
  out = BIO_new_fp(stdout, BIO_NOCLOSE);
- if(BIO_do_connect(cbio) <= 0) {
-       fprintf(stderr, "Error connecting to server\n");
-       ERR_print_errors_fp(stderr);
-       /* whatever ... */
      }
+ if (BIO_do_connect(cbio) <= 0) {
+     fprintf(stderr, "Error connecting to server\n");
+     ERR_print_errors_fp(stderr);
+     exit(1);
+ }
  BIO_puts(cbio, "GET / HTTP/1.0\n\n");
- for(;;) {     
-       len = BIO_read(cbio, tmpbuf, 1024);
-       if(len <= 0) break;
-       BIO_write(out, tmpbuf, len);
+ for ( ; ; ) {
+     len = BIO_read(cbio, tmpbuf, 1024);
+     if(len <= 0)
+         break;
+     BIO_write(out, tmpbuf, len);
  }
  BIO_free(cbio);
  BIO_free(out);
@@ -185,3 +186,14 @@ to retrieve a page and copy the result to standard output.
 =head1 SEE ALSO
 
 L<BIO_ADDR(3)>
+
+=head1 COPYRIGHT
+
+Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
+
+Licensed under the OpenSSL license (the "License").  You may not use
+this file except in compliance with the License.  You can obtain a copy
+in the file LICENSE in the source distribution or at
+L<https://www.openssl.org/source/license.html>.
+
+=cut