xref: /freebsd/secure/lib/libcrypto/man/man3/BIO_connect.3 (revision ba3c1f5972d7b90feb6e6da47905ff2757e0fe57)
Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40)

Standard preamble:
========================================================================
..
..
.. Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================

Title "BIO_CONNECT 3"
BIO_CONNECT 3 "2023-05-30" "3.0.9" "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 \fB\s-1BIO_SOCK_REUSEADDR\s0, which is described in \*(L"\s-1FLAGS\*(R"\s0 below.

\fBBIO_connect() connects sock to the address and service given by \fBaddr. Connection options may be zero or any combination of \fB\s-1BIO_SOCK_KEEPALIVE\s0, \s-1BIO_SOCK_NONBLOCK\s0 and \s-1BIO_SOCK_NODELAY\s0. The flags are described in \*(L"\s-1FLAGS\*(R"\s0 below.

\fBBIO_listen() has sock start listening on the address and service given by addr. Connection options may be zero or any combination of \s-1BIO_SOCK_KEEPALIVE\s0, \s-1BIO_SOCK_NONBLOCK\s0, \fB\s-1BIO_SOCK_NODELAY\s0, \s-1BIO_SOCK_REUSEADDR\s0 and \s-1BIO_SOCK_V6_ONLY\s0. The flags are described in \*(L"\s-1FLAGS\*(R"\s0 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 \s-1BIO_SOCK_NONBLOCK\s0, and is applied on the accepted socket. The flags are described in \*(L"\s-1FLAGS\*(R"\s0 below.

\fBBIO_closesocket() closes sock.

"FLAGS"
Header "FLAGS"
"\s-1BIO_SOCK_KEEPALIVE\s0" 4
Item "BIO_SOCK_KEEPALIVE" Enables regular sending of keep-alive messages.
"\s-1BIO_SOCK_NONBLOCK\s0" 4
Item "BIO_SOCK_NONBLOCK" Sets the socket to nonblocking mode.
"\s-1BIO_SOCK_NODELAY\s0" 4
Item "BIO_SOCK_NODELAY" Corresponds to \s-1TCP_NODELAY\s0, 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.
"\s-1BIO_SOCK_REUSEADDR\s0" 4
Item "BIO_SOCK_REUSEADDR" Try to reuse the address and port combination for a recently closed port.
"\s-1BIO_SOCK_V6_ONLY\s0" 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 \s-1INVALID_SOCKET\s0 (-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 \fB\s-1INVALID_SOCKET\s0 (-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" \s-1BIO_ADDR\s0\|(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 \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at <https://www.openssl.org/source/license.html>.