Lines Matching +full:wait +full:- +full:retry +full:- +full:us

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
44 L<ossl-guide-tls-client-block(7)> page we assume that you are familiar with it
56 sock = -1;
70 application has to do, it must also be prepared to come back and retry the
74 before), but this does not have to be the case. It can retry at any time.
76 Note that it is important that you retry exactly the same operation that you
80 some other text when you retry the operation.
83 other work. In fact, for the sake of simplicity, it will do nothing except wait
86 We call our function C<wait_for_activity()> because all it does is wait until
102 * Wait until the socket is writeable or readable. We use select here
138 connection has failed), or non-fatal (for example because we are trying to read
146 out what type of error has occurred. If the error is non-fatal and can be
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
176 /* Temporary failure. Wait until we can read and try again */
181 /* Temporary failure. Wait until we can write and try again */
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
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.
233 continue; /* Retry */
235 goto end; /* Cannot retry: error */
238 We continually call L<SSL_connect(3)> until it gives us a success response.
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
251 retry. An optional mode does exist (B<SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER>)
253 one retry to the next. However, in this case, you must still retry exactly the
254 same data - even though the buffer that contains that data may change location.
256 blocking tutorial (L<ossl-guide-tls-client-block(7)>) we write the request
262 continue; /* Retry */
264 goto end; /* Cannot retry: error */
268 continue; /* Retry */
270 goto end; /* Cannot retry: error */
274 continue; /* Retry */
276 goto end; /* Cannot retry: error */
292 continue; /* Retry */
296 case -1:
299 goto end; /* Cannot retry: error */
305 * number of bytes that we read. The data could be non-printable or
315 The main difference this time is that it is valid for us to receive an EOF
334 Since we are using a nonblocking socket we might expect to have to retry this
345 continue; /* Retry */
353 goto end; /* Cannot retry: error */
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)>