1BIO_CONNECT(3ossl)                  OpenSSL                 BIO_CONNECT(3ossl)
2
3
4

NAME

6       BIO_socket, BIO_bind, BIO_connect, BIO_listen, BIO_accept_ex,
7       BIO_closesocket - BIO socket communication setup routines
8

SYNOPSIS

10        #include <openssl/bio.h>
11
12        int BIO_socket(int domain, int socktype, int protocol, int options);
13        int BIO_bind(int sock, const BIO_ADDR *addr, int options);
14        int BIO_connect(int sock, const BIO_ADDR *addr, int options);
15        int BIO_listen(int sock, const BIO_ADDR *addr, int options);
16        int BIO_accept_ex(int accept_sock, BIO_ADDR *peer, int options);
17        int BIO_closesocket(int sock);
18

DESCRIPTION

20       BIO_socket() creates a socket in the domain domain, of type socktype
21       and protocol.  Socket options are currently unused, but is present for
22       future use.
23
24       BIO_bind() binds the source address and service to a socket and may be
25       useful before calling BIO_connect().  The options may include
26       BIO_SOCK_REUSEADDR, which is described in "FLAGS" below.
27
28       BIO_connect() connects sock to the address and service given by addr.
29       Connection options may be zero or any combination of
30       BIO_SOCK_KEEPALIVE, BIO_SOCK_NONBLOCK and BIO_SOCK_NODELAY.  The flags
31       are described in "FLAGS" below.
32
33       BIO_listen() has sock start listening on the address and service given
34       by addr.  Connection options may be zero or any combination of
35       BIO_SOCK_KEEPALIVE, BIO_SOCK_NONBLOCK, BIO_SOCK_NODELAY,
36       BIO_SOCK_REUSEADDR and BIO_SOCK_V6_ONLY.  The flags are described in
37       "FLAGS" below.
38
39       BIO_accept_ex() waits for an incoming connections on the given socket
40       accept_sock.  When it gets a connection, the address and port of the
41       peer gets stored in peer if that one is non-NULL.  Accept options may
42       be zero or BIO_SOCK_NONBLOCK, and is applied on the accepted socket.
43       The flags are described in "FLAGS" below.
44
45       BIO_closesocket() closes sock.
46

FLAGS

48       BIO_SOCK_KEEPALIVE
49           Enables regular sending of keep-alive messages.
50
51       BIO_SOCK_NONBLOCK
52           Sets the socket to nonblocking mode.
53
54       BIO_SOCK_NODELAY
55           Corresponds to TCP_NODELAY, and disables the Nagle algorithm.  With
56           this set, any data will be sent as soon as possible instead of
57           being buffered until there's enough for the socket to send out in
58           one go.
59
60       BIO_SOCK_REUSEADDR
61           Try to reuse the address and port combination for a recently closed
62           port.
63
64       BIO_SOCK_V6_ONLY
65           When creating an IPv6 socket, make it only listen for IPv6
66           addresses and not IPv4 addresses mapped to IPv6.
67
68       These flags are bit flags, so they are to be combined with the "|"
69       operator, for example:
70
71        BIO_connect(sock, addr, BIO_SOCK_KEEPALIVE | BIO_SOCK_NONBLOCK);
72

RETURN VALUES

74       BIO_socket() returns the socket number on success or INVALID_SOCKET
75       (-1) on error.  When an error has occurred, the OpenSSL error stack
76       will hold the error data and errno has the system error.
77
78       BIO_bind(), BIO_connect() and BIO_listen() return 1 on success or 0 on
79       error.  When an error has occurred, the OpenSSL error stack will hold
80       the error data and errno has the system error.
81
82       BIO_accept_ex() returns the accepted socket on success or
83       INVALID_SOCKET (-1) on error.  When an error has occurred, the OpenSSL
84       error stack will hold the error data and errno has the system error.
85

SEE ALSO

87       BIO_ADDR(3)
88

HISTORY

90       BIO_gethostname(), BIO_get_port(), BIO_get_host_ip(),
91       BIO_get_accept_socket() and BIO_accept() were deprecated in OpenSSL
92       1.1.0.  Use the functions described above instead.
93
95       Copyright 2016-2020 The OpenSSL Project Authors. All Rights Reserved.
96
97       Licensed under the Apache License 2.0 (the "License").  You may not use
98       this file except in compliance with the License.  You can obtain a copy
99       in the file LICENSE in the source distribution or at
100       <https://www.openssl.org/source/license.html>.
101
102
103
1043.0.5                             2022-11-01                BIO_CONNECT(3ossl)
Impressum