SSL_GET_FD(3SSL)
π SSL_GET_FD π
okay bestie, welcome to SSL_GET_FD(3SSL) β yes it's an OpenSSL manpage, yes it's about plumbing, and yes we are gonna make it cute. this is the one where you find out which file descriptor your precious little SSL object is actually attached to. three functions, one vibe: SSL_get_fd, SSL_get_rfd, and SSL_get_wfd. iykyk π¦
β¨ NAME β¨
SSL_get_fd, SSL_get_rfd, SSL_get_wfd β get the file descriptor linked to an SSL object π
πΈ SYNOPSIS πΈ
#include <openssl/ssl.h>
int SSL_get_fd(const SSL *ssl);
int SSL_get_rfd(const SSL *ssl);
int SSL_get_wfd(const SSL *ssl);
π DESCRIPTION π
so here's the tea, bestie. an SSL object is doing its SSL thing, but underneath it's still talking over a file descriptor somewhere. these three functions are literally just you asking "which one tho?"
SSL_get_fd()β returns the file descriptor which is linked to ssl. π«ΆSSL_get_rfd()andSSL_get_wfd()β these ones return the file descriptors for the read channel and the write channel respectively. and here's the plot twist: they can be different! like, your SSL object can be reading from one place and writing to another. main character energy honestly. π
and the β¨important loreβ¨: if the read channel and the write channel are different, then SSL_get_fd() will hand you the file descriptor of the read channel. so it's not just "a" fd, it's specifically the read one. no cap. π
π₯ RETURN VALUES π₯
here's what you can get back, babes:
-1β the operation failed π because the underlying BIO is not of the correct type (aka not suitable for file descriptors). it's giving "wrong BIO, wrong club.">=0β slay! this is the file descriptor linked to ssl. π
π SEE ALSO π
SSL_set_fd(3)β the other half of the relationship, go set that fd bestiessl(7)bio(7)
π 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 a wrap on SSL_GET_FD(3SSL) from OpenSSL version 4.0.3, dated 2026-09-29. go forth and check your file descriptors, bestie β you ate that fr fr πβ¨π¦
π¦ where this page comes from
- ubuntu stonking: libssl-doc 4.0.3-1ubuntu1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms