Lines Matching +full:non +full:- +full:l
6 demos/guide/quic-client-non-block.c
12 ossl-guide-quic-client-non-block
13 - OpenSSL Guide: Writing a simple nonblocking QUIC client
18 L<ossl-guide-quic-client-block(7)> page which demonstrates how to write a simple
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>.
42 L<SSL_read_ex(3)> or L<SSL_write_ex(3)> will return immediately with a non-fatal
46 L<ossl-guide-quic-client-block(7)> page we assume that you are familiar with it
127 TLS (see L<ossl-guide-tls-client-non-block(7)>) then you should note that there
134 L<SSL_read_ex(3)> or L<SSL_write_ex(3)> (or similar) call which indicates the
139 socket for a QUIC application we must call the L<SSL_net_read_desired(3)> and
140 L<SSL_net_write_desired(3)> functions.
143 otherwise call the L<SSL_handle_events(3)> function) to ensure that the QUIC
146 while the application goes off to do other work. The L<SSL_get_event_timeout(3)>
148 to call an I/O function (or call L<SSL_handle_events(3)>).
150 An alternative to using L<SSL_get_event_timeout(3)> to find the next deadline
153 periodically call L<SSL_handle_events(3)> automatically, meaning that the
156 L</Creating the SSL_CTX and SSL objects> below for further details about this.
169 L<SSL_read_ex(3)> or L<SSL_write_ex(3)>. Errors may be fatal for the stream (for
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
175 L<SSL_read(3)> and L<SSL_write(3)> will return 0 or a negative value to indicate
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
180 retried then L<SSL_get_error(3)> will return B<SSL_ERROR_WANT_READ> or
182 from the stream but was unable to. Note that a call to L<SSL_read_ex(3)> or
183 L<SSL_read(3)> can still generate B<SSL_ERROR_WANT_WRITE>. Similarly calls to
184 L<SSL_write_ex(3)> or L<SSL_write(3)> might generate B<SSL_ERROR_WANT_READ>.
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
196 by calling L<ERR_print_errors(3)> to print out details of errors that have
198 L<SSL_get_stream_read_state(3)> to determine whether the error is local to the
221 return -1;
226 * stream reset - or some failure occurred on the underlying
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
277 L<SSL_set_blocking_mode(3)> function:
292 L<SSL_handle_events(3)> (or alternatively any I/O function) is called on the
294 state. See L</Performing work while waiting for the socket> for more discussion
300 this we must use L<OSSL_QUIC_client_thread_method(3)> when we construct the
311 As in the demo for a blocking QUIC client we use the L<SSL_connect(3)> function
314 non-fatal error while we are waiting for the server to respond to our handshake
315 messages. In such a case we must retry the same L<SSL_connect(3)> call at a
326 We continually call L<SSL_connect(3)> until it gives us a success response.
333 As with the blocking QUIC client demo we use the L<SSL_write_ex(3)> function to
334 send data to the server. As with L<SSL_connect(3)> above, because we are using
335 a nonblocking B<SSL> object, this call could fail with a non-fatal error. In
336 that case we should retry exactly the same L<SSL_write_ex(3)> call again. Note
342 case, you must still retry exactly the same data - even though the buffer that
343 contains that data may change location. See L<SSL_CTX_set_mode(3)> for further
344 details. As in the TLS tutorials (L<ossl-guide-tls-client-block(7)>) we write
349 the SSL_WRITE_FLAG_CONCLUDE flag to L<SSL_write_ex2(3)> or by calling
350 L<SSL_stream_conclude(3)>. Since the first way is more efficient, we choose to
391 case -1:
400 * number of bytes that we read. The data could be non-printable or
426 L<SSL_shutdown(3)>.
429 L<SSL_shutdown(3)> give a return value of 0, and then we should continue to call
432 have to retry this operation several times. If L<SSL_shutdown(3)> returns a
433 negative result then we must call L<SSL_get_error(3)> to work out what to do
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.
471 L<https://www.openssl.org/source/license.html>.