BIO_S_SOCKET(3ossl)
π BIO_S_SOCKET(3ossl) β bestie, it's the socket BIO π
okay so this is BIO_s_socket and BIO_new_socket from the OpenSSL manual, third section, and it's literally the moment sockets become a BIO. grab a strawberry π and let's go.
β¨ NAME β¨
BIO_s_socket, BIO_new_socket β it's giving socket BIO π¦
β¨ SYNOPSIS β¨
#include <openssl/bio.h>
const BIO_METHOD *BIO_s_socket(void);
BIO *BIO_new_socket(int sock, int close_flag);
yes bestie, two whole functions, both iconic, both here π
β¨ DESCRIPTION β¨
BIO_s_socket() hands you the socket BIO method. what even is that? it's a lil wrapper round the platform's socket routines β like a cute jacket for your socket, no cap. π
BIO_read_ex() and BIO_write_ex() read or write the underlying socket. that's the whole job fr fr.
BIO_puts() is supported but BIO_gets() is NOT. π« read that again. supported: puts. not supported: gets. don't come for me, that's just what it says.
if the close flag is set then the socket is shut down and closed when the BIO is freed. so like, the BIO dies, the socket dies too. ride or die energy π
BIO_new_socket() returns a socket BIO using sock and close_flag. that's it, that's the function. π
β¨ NOTES β¨
socket BIOs also support any relevant functionality of file descriptor BIOs. so you get the fd perks too, lucky you β¨
now, the tea on why there's separate file descriptor and socket BIOs: on some platforms sockets are not file descriptors and they use distinct I/O routines. Windows is one such platform. π
β οΈ any code mixing the two will not work on all platforms. not "might", not "sometimes", will not. so pls don't mix them and then act surprised, bestie π
β¨ RETURN VALUES β¨
BIO_s_socket()β returns the socket BIO method. πBIO_new_socket()β returns the newly allocated BIO, orNULLis 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>. π¦
okay that's the whole page, you ate it π
β¨ this was OpenSSL version 3.5.9, dated 2026-09-29, and it's been a whole BIO_S_SOCKET(3ossl) moment. mwah, bye bestie ππ«Άπ
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms