Sortix cross-volatile manual
This manual documents Sortix cross-volatile. You can instead view this document in the latest official manual.
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(const 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);
BIO_get_conn_int_port(BIO *b);
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.- BIO_CONN_S_BEFORE
- The BIO is idle and no connection has been initiated yet.
- BIO_CONN_S_GET_IP
- The hostname to connect to needs to be converted to an IP address.
- BIO_CONN_S_GET_PORT
- The service name to connect to needs to be converted to a TCP port number.
- BIO_CONN_S_CREATE_SOCKET
- The TCP socket needs to be created with the socket(2) system call.
- BIO_CONN_S_NBIO
- Socket options may need to be set using fcntl(2) and setsockopt(2).
- BIO_CONN_S_CONNECT
- The connection needs to be initiated with the connect(2) system call.
- BIO_CONN_S_BLOCKED_CONNECT
- The connect(2) system call would have blocked and needs to be tried again.
- BIO_CONN_S_OK
- The connection has been established and can now be used to transfer data.
cmd constant |
larg | corresponding macro |
BIO_C_DO_STATE_MACHINE | 0 | BIO_do_connect() |
BIO_C_GET_CONNECT | 0 | BIO_get_conn_hostname() |
1 | BIO_get_conn_port() | |
2 | BIO_get_conn_ip() | |
3 | BIO_get_conn_int_port() | |
BIO_C_GET_FD | 0 | BIO_get_fd(3) |
BIO_C_SET_CONNECT | 0 | BIO_set_conn_hostname() |
1 | BIO_set_conn_port() | |
2 | BIO_set_conn_ip() | |
3 | BIO_set_conn_int_port() | |
BIO_C_SET_NBIO | n | BIO_set_nbio() |
BIO_CTRL_GET_CLOSE | 0 | BIO_get_close(3) |
BIO_CTRL_RESET | 0 | BIO_reset(3) |
BIO_CTRL_SET_CLOSE | flag | BIO_set_close(3) |
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);