Lines Matching +full:wait +full:- +full:retry +full:- +full:us
1 .\" -*- mode: troff; coding: utf-8 -*-
57 .IX Title "OSSL-GUIDE-TLS-CLIENT-NON-BLOCK 7ossl"
58 .TH OSSL-GUIDE-TLS-CLIENT-NON-BLOCK 7ossl 2025-09-30 3.5.4 OpenSSL
64 ossl\-guide\-tls\-client\-non\-block
65 \&\- OpenSSL Guide: Writing a simple nonblocking TLS client
69 \&\fBossl\-guide\-tls\-client\-block\fR\|(7) page which demonstrates how to write a simple
75 \&\fBtls\-client\-non\-block.c\fR. It is also available online at
76 <https://github.com/openssl/openssl/blob/master/demos/guide/tls\-client\-non\-block.c>.
89 currently unable to read or write will return immediately with a non-fatal
95 \&\fBossl\-guide\-tls\-client\-block\fR\|(7) page we assume that you are familiar with it
107 \& sock = \-1;
121 application has to do, it must also be prepared to come back and retry the
125 before), but this does not have to be the case. It can retry at any time.
127 Note that it is important that you retry exactly the same operation that you
131 some other text when you retry the operation.
134 other work. In fact, for the sake of simplicity, it will do nothing except wait
137 We call our function \f(CWwait_for_activity()\fR because all it does is wait until
154 \& * Wait until the socket is writeable or readable. We use select here
190 connection has failed), or non-fatal (for example because we are trying to read
198 out what type of error has occurred. If the error is non-fatal and can be
207 Another type of non-fatal error that may occur is \fBSSL_ERROR_ZERO_RETURN\fR. This
208 indicates an EOF (End-Of-File) which can occur if you attempt to read data from
229 \& /* Temporary failure. Wait until we can read and try again */
234 \& /* Temporary failure. Wait until we can write and try again */
243 \& return \-1;
253 \& return \-1;
256 \& return \-1;
263 the event of a non-fatal failure, it waits until a retry of the I/O operation
265 in the previous section). It returns 1 in the event of a non-fatal error
266 (except EOF), 0 in the event of EOF, or \-1 if a fatal error occurred.
271 on the \fBossl\-guide\-tls\-client\-block\fR\|(7) page. We won't repeat that information
277 socket it is very likely that calls to this function will fail with a non-fatal
279 In such a case we must retry the same \fBSSL_connect\fR\|(3) call at a later time.
286 \& continue; /* Retry */
288 \& goto end; /* Cannot retry: error */
292 We continually call \fBSSL_connect\fR\|(3) until it gives us a success response.
300 a nonblocking socket, this call could fail with a non-fatal error. In that case
301 we should retry exactly the same \fBSSL_write_ex\fR\|(3) call again. Note that the
304 retry. An optional mode does exist (\fBSSL_MODE_ACCEPT_MOVING_WRITE_BUFFER\fR)
306 one retry to the next. However, in this case, you must still retry exactly the
307 same data \- even though the buffer that contains that data may change location.
309 blocking tutorial (\fBossl\-guide\-tls\-client\-block\fR\|(7)) we write the request
316 \& continue; /* Retry */
318 \& goto end; /* Cannot retry: error */
322 \& continue; /* Retry */
324 \& goto end; /* Cannot retry: error */
328 \& continue; /* Retry */
330 \& goto end; /* Cannot retry: error */
348 \& continue; /* Retry */
352 \& case \-1:
355 \& goto end; /* Cannot retry: error */
361 \& * number of bytes that we read. The data could be non\-printable or
372 The main difference this time is that it is valid for us to receive an EOF
390 Since we are using a nonblocking socket we might expect to have to retry this
402 \& continue; /* Retry */
410 \& goto end; /* Cannot retry: error */
420 See \fBossl\-guide\-tls\-client\-block\fR\|(7) to read a tutorial on how to write a
421 blocking TLS client. See \fBossl\-guide\-quic\-client\-block\fR\|(7) to see how to do the
425 \&\fBossl\-guide\-introduction\fR\|(7), \fBossl\-guide\-libraries\-introduction\fR\|(7),
426 \&\fBossl\-guide\-libssl\-introduction\fR\|(7), \fBossl\-guide\-tls\-introduction\fR\|(7),
427 \&\fBossl\-guide\-tls\-client\-block\fR\|(7), \fBossl\-guide\-quic\-client\-block\fR\|(7)