SSL_connect.pod revision 72613
168651Skris=pod
268651Skris
368651Skris=head1 NAME
468651Skris
568651SkrisSSL_connect - initiate the TLS/SSL handshake with an TLS/SSL server
668651Skris
768651Skris=head1 SYNOPSIS
868651Skris
968651Skris #include <openssl/ssl.h>
1068651Skris
1168651Skris int SSL_connect(SSL *ssl);
1268651Skris
1368651Skris=head1 DESCRIPTION
1468651Skris
1568651SkrisSSL_connect() initiates the TLS/SSL handshake with a server. The communication
1668651Skrischannel must already have been set and assigned to the B<ssl> by setting an
1768651Skrisunderlying B<BIO>.
1868651Skris
1968651Skris=head1 NOTES
2068651Skris
2168651SkrisThe behaviour of SSL_connect() depends on the underlying BIO. 
2268651Skris
2368651SkrisIf the underlying BIO is B<blocking>, SSL_connect() will only return once the
2468651Skrishandshake has been finished or an error occurred.
2568651Skris
2668651SkrisIf the underlying BIO is B<non-blocking>, SSL_connect() will also return
2768651Skriswhen the underlying BIO could not satisfy the needs of SSL_connect()
2868651Skristo continue the handshake. In this case a call to SSL_get_error() with the
2968651Skrisreturn value of SSL_connect() will yield B<SSL_ERROR_WANT_READ> or
3068651SkrisB<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after
3168651Skristaking appropriate action to satisfy the needs of SSL_connect().
3268651SkrisThe action depends on the underlying BIO. When using a non-blocking socket,
3368651Skrisnothing is to be done, but select() can be used to check for the required
3468651Skriscondition. When using a buffering BIO, like a BIO pair, data must be written
3568651Skrisinto or retrieved out of the BIO before being able to continue.
3668651Skris
3768651Skris=head1 RETURN VALUES
3868651Skris
3968651SkrisThe following return values can occur:
4068651Skris
4168651Skris=over 4
4268651Skris
4368651Skris=item 1
4468651Skris
4568651SkrisThe TLS/SSL handshake was successfully completed, a TLS/SSL connection has been
4668651Skrisestablished.
4768651Skris
4868651Skris=item 0
4968651Skris
5068651SkrisThe TLS/SSL handshake was not successful but was shut down controlled and
5168651Skrisby the specifications of the TLS/SSL protocol. Call SSL_get_error() with the
5268651Skrisreturn value B<ret> to find out the reason.
5368651Skris
5472613Skris=item E<lt>0
5568651Skris
5668651SkrisThe TLS/SSL handshake was not successful, because a fatal error occurred either
5768651Skrisat the protocol level or a connection failure occurred. The shutdown was
5868651Skrisnot clean. It can also occur of action is need to continue the operation
5968651Skrisfor non-blocking BIOs. Call SSL_get_error() with the return value B<ret>
6068651Skristo find out the reason.
6168651Skris
6268651Skris=back
6368651Skris
6468651Skris=head1 SEE ALSO
6568651Skris
6668651SkrisL<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_accept(3)|SSL_accept(3)>,
6772613SkrisL<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>
6868651Skris
6968651Skris=cut
70