BIO_S_SOCKET(3ossl)
π BIO_S_SOCKET(3ossl) β like, the socket BIO page, bestie
okay so this is the OpenSSL manual page for BIO_s_socket and BIO_new_socket, aka the socket BIO situation. it's from the OpenSSL docs set (the 3ossl one, iykyk) and honestly it's short and slay, so let's go π«Ά
β¨ NAME β¨
BIO_s_socket, BIO_new_socket β socket BIO π
π¦ SYNOPSIS π¦
#include <openssl/bio.h>
const BIO_METHOD *BIO_s_socket(void);
BIO *BIO_new_socket(int sock, int close_flag);
like, that's it. two functions. main character energy fr fr π
πΈ DESCRIPTION πΈ
BIO_s_socket() hands you back the socket BIO method. it's basically a little wrapper round the platform's socket routines β the way that it just sits there and lets the platform do the actual socket work π
BIO_read_ex() and BIO_write_ex() are the ones that read or write the underlying socket. BIO_puts() is supported, but BIO_gets()? nope, not a thing, she did not get an invite π
if the close flag is set, then the socket gets shut down and closed when the BIO is freed. so like, cleanup queen behavior β¨
BIO_new_socket() returns a socket BIO using sock and close_flag.
π NOTES π
socket BIOs also support any relevant functionality of file descriptor BIOs, so that whole vibe is still available to you π«Ά
now, why are file descriptor BIOs and socket BIOs even separate things? because on some platforms, sockets are not file descriptors and they use distinct I/O routines. Windows is one such platform, no cap.
β οΈ any code mixing the two will not work on all platforms. so like, don't do that. seriously. this is a real portability warning, not me being dramatic for once π
π RETURN VALUES π
BIO_s_socket() returns the socket BIO method. iconic, consistent, no notes β
BIO_new_socket() returns the newly allocated BIO, or NULL if an error occurred π (yes, the original literally says "or NULL is an error occurred" β we love a typo moment, but the meaning is "if an error occurred" π
)
π COPYRIGHT π
Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (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 <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie π no SEE ALSO section to report, so we're done here. this was BIO_S_SOCKET(3ossl) from OpenSSL version 3.5.6, dated 2026-04-07 β mwah, go close your sockets properly ππ
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms