---
name: "libressl-SSL_get_fd"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-SSL_get_fd"
---

# libressl-SSL\_get\_fd(3)

get file descriptor linked to an SSL object

## NAME

**SSL\_get\_fd**, **SSL\_get\_rfd**, **SSL\_get\_wfd** – get file descriptor linked to an SSL object

## SYNOPSIS

SSL Library (libssl, -lssl) libcrypto

**#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

**SSL\_get\_fd**() returns the file descriptor which is linked to *ssl*. **SSL\_get\_rfd**() and **SSL\_get\_wfd**() return the file descriptors for the read or the write channel, which can be different. If the read and the write channel are different, **SSL\_get\_fd**() will return the file descriptor of the read channel.

## RETURN VALUES

The following return values can occur:

- −1

  The operation failed, because the underlying *BIO* is not of the correct type (suitable for file descriptors).

- ≥0

  The file descriptor linked to *ssl*.

## SEE ALSO

BIO\_new(3), [ssl(3)](/ssl/3.md), SSL\_set\_fd(3)

## HISTORY

**SSL\_get\_fd**() appeared in SSLeay 0.4 or earlier and has been available since OpenBSD 2.4.

**SSL\_get\_rfd**() and **SSL\_get\_wfd**() first appeared in OpenSSL 0.9.6c and have been available since OpenBSD 3.2.
