.\" $OpenBSD: BIO_s_socket.3,v 1.4 2016/11/07 15:52:47 jmc Exp $ .\" .Dd $Mdocdate: November 7 2016 $ .Dt BIO_S_SOCKET 3 .Os .Sh NAME .Nm BIO_s_socket , .Nm BIO_new_socket .Nd socket BIO .Sh SYNOPSIS .In openssl/bio.h .Ft BIO_METHOD * .Fo BIO_s_socket .Fa void .Fc .Ft BIO * .Fo BIO_new_socket .Fa "int sock" .Fa "int close_flag" .Fc .Sh DESCRIPTION .Fn BIO_s_socket returns the socket BIO method. This is a wrapper around the platform's socket routines. .Pp .Xr BIO_read 3 and .Xr BIO_write 3 read or write the underlying socket. .Xr BIO_puts 3 is supported but .Xr BIO_gets 3 is not. .Pp If the close flag is set, then the socket is shut down and closed when the BIO is freed. .Pp .Fn BIO_new_socket returns a socket BIO using .Fa sock and .Fa close_flag . .Pp Socket BIOs also support any relevant functionality of file descriptor BIOs. .Pp 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. .Sh RETURN VALUES .Fn BIO_s_socket returns the socket BIO method. .Pp .Fn BIO_new_socket returns the newly allocated BIO or .Dv NULL if an error occurred. .Sh SEE ALSO .Xr BIO_get_fd 3