BIO_SOCKET_WAIT(3ossl)
π NAME π
okay so this is the BIO_socket_wait(3ossl) page from OpenSSL, bestie, and it's literally about BIO_socket_wait, BIO_wait, and BIO_do_connect_retry. The official NAME line is exactly:
BIO_socket_wait, BIO_wait, BIO_do_connect_retry - BIO connection utility functions
slay, we're doing socket waiting today π
β¨ SYNOPSIS β¨
#include <openssl/bio.h>
#ifndef OPENSSL_NO_SOCK
int BIO_socket_wait(int fd, int for_read, time_t max_time);
#endif
int BIO_wait(BIO *bio, time_t max_time, unsigned int nap_milliseconds);
int BIO_do_connect_retry(BIO *bio, int timeout, int nap_milliseconds);
note the #ifndef OPENSSL_NO_SOCK guard around BIO_socket_wait, iykyk π«Ά
π DESCRIPTION π
BIO_socket_wait() waits on the socket fd for reading if for_read is not 0, else for writing, and it waits at most until max_time. It succeeds immediately if max_time == 0, which means no timeout was given. iconic behavior honestly β¨
BIO_wait() waits at most until max_time on the given (typically socket-based) bio, for reading if bio is supposed to read, else for writing. It is used by BIO_do_connect_retry() and can be used together with BIO_read(3). It also succeeds immediately if max_time == 0, which means no timeout given. If sockets are not available, it still supports polling by succeeding after sleeping at most the given nap_milliseconds, specifically so you don't get a tight busy loop. Via nap_milliseconds, the caller determines the polling granularity. go off, polling queen π¦
BIO_do_connect_retry() connects via the given bio. It retries BIO_do_connect() as far as needed to reach a definite outcome, i.e., connection succeeded, timeout has been reached, or an error occurred. For nonblocking and potentially even non-socket BIOs it polls every nap_milliseconds and sleeps in between using BIO_wait(). If nap_milliseconds is < 0 then a default value of 100 ms is used. If the timeout parameter is > 0 this indicates the maximum number of seconds to wait until the connection is established or a definite error occurred. A value of 0 enables waiting indefinitely (i.e., no timeout), while a value < 0 means that BIO_do_connect() is tried only once. The function may, directly or indirectly, invoke ERR_clear_error().
bestie, thetimeoutandnap_millisecondsvalues are doing main character energy here β don't mix them up π
π RETURN VALUES π
BIO_socket_wait(), BIO_wait(), and BIO_do_connect_retry() return:
-1on error0on timeout1on success
periodt π
π¦ SEE ALSO π¦
β HISTORY β
BIO_socket_wait(), BIO_wait(), and BIO_do_connect_retry() were added in OpenSSL 3.0. vintage but still very much that girl πΈ
π COPYRIGHT π
Copyright 2019-2020 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, bestie β source/version 3.5.0, date 2026-09-25, and the manual name is BIO_SOCKET_WAIT(3ossl). byeee ππ
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms