Lines Matching +full:continue +full:- +full:on +full:- +full:error

6 demos/guide/quic-client-non-block.c
12 ossl-guide-quic-client-non-block
13 - OpenSSL Guide: Writing a simple nonblocking QUIC client
17 This page will build on the example developed on the
18 L<ossl-guide-quic-client-block(7)> page which demonstrates how to write a simple
19 blocking QUIC client. On this page we will amend that demo code so that it
24 B<quic-client-non-block.c>. It is also available online at
25 L<https://github.com/openssl/openssl/blob/master/demos/guide/quic-client-non-block.c>.
34 cases. The execution of the code will simply stop until it is able to continue.
38 operations on some other connection or stream.
42 L<SSL_read_ex(3)> or L<SSL_write_ex(3)> will return immediately with a non-fatal
43 error if they are currently unable to read or write respectively.
45 Since this page is building on the example developed on the
46 L<ossl-guide-quic-client-block(7)> page we assume that you are familiar with it
58 such that it might succeed on the retry attempt, but this does not have to be
113 * Let's say for example that you want to update the progress counter on
117 * check if it did so because of activity on the file descriptors or
127 TLS (see L<ossl-guide-tls-client-non-block(7)>) then you should note that there
160 available on most Operating Systems. However you could use any other similar
171 has failed), or non-fatal (for example because we are trying to read from the
174 L<SSL_read_ex(3)> and L<SSL_write_ex(3)> will return 0 to indicate an error and
176 an error. L<SSL_shutdown(3)> will return a negative value to incidate an error.
178 In the event of an error an application should call L<SSL_get_error(3)> to find
179 out what type of error has occurred. If the error is non-fatal and can be
181 B<SSL_ERROR_WANT_WRITE> depending on whether OpenSSL wanted to read to or write
186 Another type of non-fatal error that may occur is B<SSL_ERROR_ZERO_RETURN>. This
187 indicates an EOF (End-Of-File) which can occur if you attempt to read data from
189 on the stream. In this case you may still want to write data to the stream but
195 failed. You can consult the OpenSSL error stack for further details (for example
198 L<SSL_get_stream_read_state(3)> to determine whether the error is local to the
221 return -1;
225 * Some stream fatal error occurred. This could be because of a
226 * stream reset - or some failure occurred on the underlying
248 * If the failure is due to a verification error we can get more
252 printf("Verify error: %s\n",
254 return -1;
257 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.
272 explained on the L<ossl-guide-quic-client-block(7)> page. We won't repeat that
292 L<SSL_handle_events(3)> (or alternatively any I/O function) is called on the
295 on this. This is particularly important to keep in mind when writing a
314 non-fatal error while we are waiting for the server to respond to our handshake
321 continue; /* Retry */
323 goto end; /* Cannot retry: error */
329 this stage, so such a response is treated in the same way as a fatal error.
335 a nonblocking B<SSL> object, this call could fail with a non-fatal error. In
339 data on a retry. An optional mode does exist
342 case, you must still retry exactly the same data - even though the buffer that
344 details. As in the TLS tutorials (L<ossl-guide-tls-client-block(7)>) we write
356 continue; /* Retry */
358 goto end; /* Cannot retry: error */
362 continue; /* Retry */
364 goto end; /* Cannot retry: error */
369 continue; /* Retry */
371 goto end; /* Cannot retry: error */
374 On a write we do not expect to see an EOF response so we treat that case in the
375 same way as a fatal error.
387 continue; /* Retry */
390 continue;
391 case -1:
394 goto end; /* Cannot retry: error */
400 * number of bytes that we read. The data could be non-printable or
415 from the server. We continue going around the loop until we either encounter a
416 fatal error, or we receive an EOF (indicating a graceful finish).
423 Even though we have received EOF on the stream that we were reading from above,
429 L<SSL_shutdown(3)> give a return value of 0, and then we should continue to call
443 continue; /* Retry */
454 See L<ossl-guide-quic-client-block(7)> to read a tutorial on how to write a
455 blocking QUIC client. See L<ossl-guide-quic-multi-stream(7)> to see how to write
456 a multi-stream QUIC client.
460 L<ossl-guide-introduction(7)>, L<ossl-guide-libraries-introduction(7)>,
461 L<ossl-guide-libssl-introduction(7)>, L<ossl-guide-quic-introduction(7)>,
462 L<ossl-guide-quic-client-block(7)>, L<ossl-guide-quic-multi-stream(7)>
466 Copyright 2023-2025 The OpenSSL Project Authors. All Rights Reserved.