SSL_GET_FD(3ossl)

πŸ’… SSL_GET_FD β€” get file descriptor linked to an SSL object

okay bestie so this is a page from the OpenSSL manuals, the 3ossl girlies, and it's about three little functions that do the very specific job of telling you which file descriptor your SSL object is attached to πŸŽ€


✨ NAME ✨

SSL_get_fd, SSL_get_rfd, SSL_get_wfd β€” get 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 like, three functions, one mission πŸ’–

  • SSL_get_fd() β€” returns the file descriptor which is linked to ssl. that's it, that's the vibe.
  • SSL_get_rfd() and SSL_get_wfd() β€” these two return the file descriptors for the read or the write channel, and no cap, those two can literally be different from each other. πŸ™ˆ
and here's the tea: if the read and the write channel are different, SSL_get_fd() will return the file descriptor of the read channel. so it's basically the read one's main character moment. πŸ‘‘

✨ RETURN VALUES ✨

here's what you can get back, bestie:

  • -1 β€” the operation failed 😭 because the underlying BIO is not of the correct type (suitable for file descriptors). wrong type, wrong vibe, it's giving incompatible.
  • >=0 β€” the file descriptor linked to ssl. slay, that's the one you wanted. ✨

✨ SEE ALSO ✨

go read those too, iykyk 🫢


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, no notes, ate and left no crumbs πŸ’…πŸŒΈ this was OpenSSL 3.5.9, dated 2026-09-29, mwah πŸ’– bye bestie, go close your file descriptors 🌈⭐

πŸ“¦ where this page comes from