Lines Matching +full:non +full:- +full:l

6 demos/guide/tls-client-non-block.c
12 ossl-guide-tls-client-non-block
13 - OpenSSL Guide: Writing a simple nonblocking TLS client
18 L<ossl-guide-tls-client-block(7)> page which demonstrates how to write a simple
24 B<tls-client-non-block.c>. It is also available online at
25 L<https://github.com/openssl/openssl/blob/master/demos/guide/tls-client-non-block.c>.
38 currently unable to read or write will return immediately with a non-fatal
41 as L<SSL_read_ex(3)> or L<SSL_write_ex(3)> will not block.
44 L<ossl-guide-tls-client-block(7)> page we assume that you are familiar with it
56 sock = -1;
136 handle errors returned from OpenSSL I/O functions such as L<SSL_read_ex(3)> or
137 L<SSL_write_ex(3)>. Errors may be fatal (for example because the underlying
138 connection has failed), or non-fatal (for example because we are trying to read
141 L<SSL_read_ex(3)> and L<SSL_write_ex(3)> will return 0 to indicate an error and
142 L<SSL_read(3)> and L<SSL_write(3)> will return 0 or a negative value to indicate
143 an error. L<SSL_shutdown(3)> will return a negative value to incidate an error.
145 In the event of an error an application should call L<SSL_get_error(3)> to find
146 out what type of error has occurred. If the error is non-fatal and can be
147 retried then L<SSL_get_error(3)> will return B<SSL_ERROR_WANT_READ> or
149 from the socket but was unable to. Note that a call to L<SSL_read_ex(3)> or
150 L<SSL_read(3)> can still generate B<SSL_ERROR_WANT_WRITE> because OpenSSL
153 L<SSL_write_ex(3)> or L<SSL_write(3)> might generate B<SSL_ERROR_WANT_READ>.
155 Another type of non-fatal error that may occur is B<SSL_ERROR_ZERO_RETURN>. This
156 indicates an EOF (End-Of-File) which can occur if you attempt to read data from
163 shut it down with L<SSL_shutdown(3)>. B<SSL_ERROR_SYSCALL> indicates that
167 L<ERR_print_errors(3)> to print out details of errors that have occurred).
190 return -1;
200 return -1;
203 return -1;
209 the event of a non-fatal failure, it waits until a retry of the I/O operation
211 in the previous section). It returns 1 in the event of a non-fatal error
212 (except EOF), 0 in the event of EOF, or -1 if a fatal error occurred.
218 on the L<ossl-guide-tls-client-block(7)> page. We won't repeat that information
223 As in the demo for a blocking TLS client we use the L<SSL_connect(3)> function
225 socket it is very likely that calls to this function will fail with a non-fatal
227 In such a case we must retry the same L<SSL_connect(3)> call at a later time.
238 We continually call L<SSL_connect(3)> until it gives us a success response.
245 As with the blocking TLS client demo we use the L<SSL_write_ex(3)> function to
246 send data to the server. As with L<SSL_connect(3)> above, because we are using
247 a nonblocking socket, this call could fail with a non-fatal error. In that case
248 we should retry exactly the same L<SSL_write_ex(3)> call again. Note that the
254 same data - even though the buffer that contains that data may change location.
255 See L<SSL_CTX_set_mode(3)> for further details. As in the TLS client
256 blocking tutorial (L<ossl-guide-tls-client-block(7)>) we write the request
296 case -1:
305 * number of bytes that we read. The data could be non-printable or
329 L<SSL_shutdown(3)> give a return value of 0, and then we would continue to call
335 operation several times. If L<SSL_shutdown(3)> returns a negative result then we
336 must call L<SSL_get_error(3)> to work out what to do next. We use our
364 See L<ossl-guide-tls-client-block(7)> to read a tutorial on how to write a
365 blocking TLS client. See L<ossl-guide-quic-client-block(7)> to see how to do the
370 L<ossl-guide-introduction(7)>, L<ossl-guide-libraries-introduction(7)>,
371 L<ossl-guide-libssl-introduction(7)>, L<ossl-guide-tls-introduction(7)>,
372 L<ossl-guide-tls-client-block(7)>, L<ossl-guide-quic-client-block(7)>
381 L<https://www.openssl.org/source/license.html>.