=pod =head1 NAME BIO_socket, BIO_connect, BIO_listen, BIO_accept_ex, BIO_closesocket - BIO socket communication setup routines =head1 SYNOPSIS #include int BIO_socket(int domain, int socktype, int protocol, 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); =head1 DESCRIPTION BIO_socket() creates a socket in the domain B, of type B and B. Socket B are currently unused, but is present for future use. BIO_connect() connects B to the address and service given by B. Connection B may be zero or any combination of B, B and B. The flags are described in L below. BIO_listen() has B start listening on the address and service given by B. Connection B may be zero or any combination of B, B, B, B and B. The flags are described in L below. BIO_accept_ex() waits for an incoming connections on the given socket B. When it gets a connection, the address and port of the peer gets stored in B if that one is non-NULL. Accept B may be zero or B, and is applied on the accepted socket. The flags are described in L below. BIO_closesocket() closes B. =head1 FLAGS =over 4 =item BIO_SOCK_KEEPALIVE Enables regular sending of keep-alive messages. =item BIO_SOCK_NONBLOCK Sets the socket to non-blocking mode. =item BIO_SOCK_NODELAY Corresponds to B, 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. =item BIO_SOCK_REUSEADDR Try to reuse the address and port combination for a recently closed port. =item BIO_SOCK_V6_ONLY When creating an IPv6 socket, make it only listen for IPv6 addresses and not IPv4 addresses mapped to IPv6. =back These flags are bit flags, so they are to be combined with the C<|> operator, for example: BIO_connect(sock, addr, BIO_SOCK_KEEPALIVE | BIO_SOCK_NONBLOCK); =head1 RETURN VALUES BIO_socket() returns the socket number on success or B (-1) on error. When an error has occurred, the OpenSSL error stack will hold the error data and errno has the system error. 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. BIO_accept_ex() returns the accepted socket on success or B (-1) on error. When an error has occurred, the OpenSSL error stack will hold the error data and errno has the system error. =head1 HISTORY BIO_gethostname(), BIO_get_port(), BIO_get_host_ip(), BIO_get_accept_socket() and BIO_accept() are deprecated since OpenSSL 1.1. Use the functions described above instead. =head1 SEE ALSO L =head1 COPYRIGHT Copyright 2016 The OpenSSL Project Authors. All Rights Reserved. Licensed under the OpenSSL license (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 L. =cut