NAME
BIO_s_connect, BIO_new_connect, BIO_set_conn_hostname, BIO_set_conn_port, BIO_set_conn_ip, BIO_set_conn_int_port, BIO_get_conn_hostname, BIO_get_conn_port, BIO_get_conn_ip, BIO_get_conn_int_port, BIO_set_nbio, BIO_do_connect — connect BIOSYNOPSIS
#include <openssl/bio.h>BIO_s_connect(void);
BIO_new_connect(char *name);
BIO_set_conn_hostname(BIO *b, char *name);
BIO_set_conn_port(BIO *b, char *port);
BIO_set_conn_ip(BIO *b, char *ip);
BIO_set_conn_int_port(BIO *b, char *port);
BIO_get_conn_hostname(BIO *b);
BIO_get_conn_port(BIO *b);
BIO_get_conn_ip(BIO *b, dummy);
BIO_get_conn_int_port(BIO *b, int port);
BIO_set_nbio(BIO *b, long n);
BIO_do_connect(BIO *b);
DESCRIPTION
BIO_s_connect() returns the connect BIO method. This is a wrapper around the platform's TCP/IP socket connection routines.NOTES
If blocking I/O is set then a non positive return value from any I/O call is caused by an error condition, although a zero return will normally mean that the connection was closed.RETURN VALUES
BIO_s_connect() returns the connect BIO method.EXAMPLES
This example connects to a webserver on the local host and attempts 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 ... */
}
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);
}
BIO_free(cbio);
BIO_free(out);