xref: /netbsd-src/crypto/external/bsd/openssl/lib/libcrypto/man/BIO_connect.3 (revision 7d9ffdb3e9da593a05c5e2169f72fc7bada08bc9)
$NetBSD: BIO_connect.3,v 1.9 2024/09/08 13:08:14 christos Exp $

-*- mode: troff; coding: utf-8 -*-
Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)

Standard preamble:
========================================================================
..
..
.. \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
. ds C` "" . ds C' "" 'br\} . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.

If the F register is >0, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.

Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF ========================================================================

Title "BIO_connect 3"
BIO_connect 3 2024-09-03 3.0.15 OpenSSL
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
NAME
BIO_socket, BIO_bind, BIO_connect, BIO_listen, BIO_accept_ex, BIO_closesocket - BIO socket communication setup routines
SYNOPSIS
Header "SYNOPSIS" .Vb 1 #include <openssl/bio.h> \& int BIO_socket(int domain, int socktype, int protocol, int options); int BIO_bind(int sock, const BIO_ADDR *addr, int options); int BIO_connect(int sock, const BIO_ADDR *addr, int options); int BIO_listen(int sock, const BIO_ADDR *addr, int options); int BIO_accept_ex(int accept_sock, BIO_ADDR *peer, int options); int BIO_closesocket(int sock); .Ve
DESCRIPTION
Header "DESCRIPTION" \fBBIO_socket() creates a socket in the domain domain, of type \fBsocktype and protocol. Socket options are currently unused, but is present for future use.

\fBBIO_bind() binds the source address and service to a socket and may be useful before calling BIO_connect(). The options may include \fBBIO_SOCK_REUSEADDR, which is described in "FLAGS" below.

\fBBIO_connect() connects sock to the address and service given by \fBaddr. Connection options may be zero or any combination of \fBBIO_SOCK_KEEPALIVE, BIO_SOCK_NONBLOCK and BIO_SOCK_NODELAY. The flags are described in "FLAGS" below.

\fBBIO_listen() has sock start listening on the address and service given by addr. Connection options may be zero or any combination of BIO_SOCK_KEEPALIVE, BIO_SOCK_NONBLOCK, \fBBIO_SOCK_NODELAY, BIO_SOCK_REUSEADDR and BIO_SOCK_V6_ONLY. The flags are described in "FLAGS" below.

\fBBIO_accept_ex() waits for an incoming connections on the given socket accept_sock. When it gets a connection, the address and port of the peer gets stored in peer if that one is non-NULL. Accept options may be zero or BIO_SOCK_NONBLOCK, and is applied on the accepted socket. The flags are described in "FLAGS" below.

\fBBIO_closesocket() closes sock.

FLAGS
Header "FLAGS"
BIO_SOCK_KEEPALIVE 4
Item "BIO_SOCK_KEEPALIVE" Enables regular sending of keep-alive messages.
BIO_SOCK_NONBLOCK 4
Item "BIO_SOCK_NONBLOCK" Sets the socket to nonblocking mode.
BIO_SOCK_NODELAY 4
Item "BIO_SOCK_NODELAY" Corresponds to TCP_NODELAY, and disables the Nagle algorithm. With this set, any data will be sent as soon as possible instead of being buffered until there's enough for the socket to send out in one go.
BIO_SOCK_REUSEADDR 4
Item "BIO_SOCK_REUSEADDR" Try to reuse the address and port combination for a recently closed port.
BIO_SOCK_V6_ONLY 4
Item "BIO_SOCK_V6_ONLY" When creating an IPv6 socket, make it only listen for IPv6 addresses and not IPv4 addresses mapped to IPv6.

These flags are bit flags, so they are to be combined with the \f(CW\*(C`|\*(C' operator, for example:

.Vb 1 BIO_connect(sock, addr, BIO_SOCK_KEEPALIVE | BIO_SOCK_NONBLOCK); .Ve

"RETURN VALUES"
Header "RETURN VALUES" \fBBIO_socket() returns the socket number on success or INVALID_SOCKET (-1) on error. When an error has occurred, the OpenSSL error stack will hold the error data and errno has the system error.

\fBBIO_bind(), BIO_connect() and BIO_listen() return 1 on success or 0 on error. When an error has occurred, the OpenSSL error stack will hold the error data and errno has the system error.

\fBBIO_accept_ex() returns the accepted socket on success or \fBINVALID_SOCKET (-1) on error. When an error has occurred, the OpenSSL error stack will hold the error data and errno has the system error.

"SEE ALSO"
Header "SEE ALSO" \fBBIO_ADDR\|(3)
HISTORY
Header "HISTORY" \fBBIO_gethostname(), BIO_get_port(), BIO_get_host_ip(), \fBBIO_get_accept_socket() and BIO_accept() were deprecated in OpenSSL 1.1.0. Use the functions described above instead.
COPYRIGHT
Header "COPYRIGHT" Copyright 2016-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>.