BIO_SOCKET_WAIT(3ossl)
π NAME π
Okay bestie, gather βround: this is the BIO_SOCKET_WAIT(3ossl) manual page, and the stars are BIO_socket_wait, BIO_wait, and BIO_do_connect_retry β literally the BIO connection utility functions. Iconic little trio. π«Ά
π οΈ 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);
πΈ DESCRIPTION πΈ
BIO_socket_wait()β It waits on the socketfdfor reading iffor_readis not0, else for writing, at most untilmax_time. It succeeds immediately ifmax_time == 0(which means no timeout given). β¨BIO_wait()β It waits at most untilmax_timeon the given (typically socket-based)bio, for reading ifbiois supposed to read, else for writing. It is used byBIO_do_connect_retry()and can be used together withBIO_read(3). It succeeds immediately ifmax_time == 0(which means no timeout given). If sockets are not available it supports polling by succeeding after sleeping at most the givennap_millisecondsin order to avoid a tight busy loop. Vianap_millisecondsthe caller determines the polling granularity. π¦BIO_do_connect_retry()β It connects via the givenbio. It retriesBIO_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 everynap_millisecondsand sleeps in between usingBIO_wait(). Ifnap_millisecondsis< 0then a default value of100 msis used. If thetimeoutparameter is> 0this indicates the maximum number of seconds to wait until the connection is established or a definite error occurred. A value of0enables waiting indefinitely (i.e., no timeout), while a value< 0means thatBIO_do_connect()is tried only once. The function may, directly or indirectly, invokeERR_clear_error(). π₯
π RETURN VALUES π
BIO_socket_wait(), BIO_wait(), and BIO_do_connect_retry() return -1 on error, 0 on timeout, and 1 on success. Thatβs the whole vibe check. π
π SEE ALSO π
π§ HISTORY π§
BIO_socket_wait(), BIO_wait(), and BIO_do_connect_retry() were added in OpenSSL 3.0. Periodt. π
π 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>.
Thatβs the page, bestie π β OpenSSL 3.5.6, dated 2026-04-07, signing off from the 3ossl manual. Slay responsibly. π§
π¦ where this page comes from
- freebsd 15.1: base 15.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms