BIO_s_socket 3 2003-07-24 0.9.9-dev OpenSSL

NAME

BIO_s_socket, BIO_new_socket - socket BIO

LIBRARY

libcrypto, -lcrypto

SYNOPSIS


 #include 


 BIO_METHOD *BIO_s_socket(void);


 long BIO_set_fd(BIO *b, int fd, long close_flag);
 long BIO_get_fd(BIO *b, int *c);


 BIO *BIO_new_socket(int sock, int close_flag);

DESCRIPTION

_B_I_O___s___s_o_c_k_e_t_(_) returns the socket BIO method. This is a wrapper round the platform's socket routines.

_B_I_O___r_e_a_d_(_) and _B_I_O___w_r_i_t_e_(_) read or write the underlying socket. _B_I_O___p_u_t_s_(_) is supported but _B_I_O___g_e_t_s_(_) is not.

If the close flag is set then the socket is shut down and closed when the BIO is freed.

_B_I_O___s_e_t___f_d_(_) sets the socket of BIO bb to ffdd and the close flag to cclloossee__ffllaagg.

_B_I_O___g_e_t___f_d_(_) places the socket in cc if it is not NULL, it also returns the socket. If cc is not NULL it should be of type (int *).

_B_I_O___n_e_w___s_o_c_k_e_t_(_) returns a socket BIO using ssoocckk and cclloossee__ffllaagg.

NOTES

Socket BIOs also support any relevant functionality of file descriptor BIOs.

The reason for having separate file descriptor and socket BIOs is that on some platforms sockets are not file descriptors and use distinct I/O routines, Windows is one such platform. Any code mixing the two will not work on all platforms.

_B_I_O___s_e_t___f_d_(_) and _B_I_O___g_e_t___f_d_(_) are macros.

RETURN VALUES

_B_I_O___s___s_o_c_k_e_t_(_) returns the socket BIO method.

_B_I_O___s_e_t___f_d_(_) always returns 1.

_B_I_O___g_e_t___f_d_(_) returns the socket or -1 if the BIO has not been initialized.

_B_I_O___n_e_w___s_o_c_k_e_t_(_) returns the newly allocated BIO or NULL is an error occurred.

SEE ALSO

TBA