SSL_GET_FD(3ossl)

πŸ“¦
version 15.1 Β· 3 versions
, in freebsd 15.1

πŸ’… SSL_GET_FD β€” like, getting the file descriptor that's linked to an SSL object πŸŽ€

okay so bestie, this is the OpenSSL page for SSL_get_fd, SSL_get_rfd, and SSL_get_wfd, and it's filed under manual name 3ossl btw β€” that's the whole gang of "which fd is this SSL thing even using" functions ✨


🌸 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);

like, three little int-returning besties that all take a const SSL *ssl β€” no cap, that's the whole signature situation 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

So SSL_get_fd() returns the file descriptor that's linked to ssl. Simple. Iconic. Main character energy fr.

Then SSL_get_rfd() and SSL_get_wfd() hand you the file descriptors for the read channel and the write channel respectively β€” and the tea here is that these two can totally be different from each other πŸ‘€

And the plot twist: if the read and the write channel are different, SSL_get_fd() will return the file descriptor of the read channel</>. That's it. That's the vibe check. πŸ’…


✨ RETURN VALUES ✨

The following return values can occur:

  • -1 β€” the operation failed 😭 because the underlying BIO is not of the correct type (meaning: not suitable for file descriptors)
  • >=0 β€” the file descriptor linked to ssl πŸ’– slay, you got it

🌈 SEE ALSO 🌈

iykyk, go read those next 🧚


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>.

ok that's the legal bit, no skipping it bestie β€” the license said what it said 🫢

and that's the whole page, mwah πŸ’‹ β€” this lil rewrite is from <star>3.5.6</star>, dated <star>2026-04-07</star>, and it lives at SSL_GET_FD(3ossl) forever and always πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from