Lines Matching full:we

33 .\" If the F register is >0, we'll generate index entries on stderr for
70 blocking TLS client. On this page we will amend that demo code so that it
78 As we saw in the previous example a blocking socket is one which waits (blocks)
95 \&\fBossl\-guide\-tls\-client\-block\fR\|(7) page we assume that you are familiar with it
96 and we only explain how this example differs.
118 we want to read or write to the socket, but we are currently unable to. In fact
133 In this demo application we will create a helper function which simulates doing
154 \& * Wait until the socket is writeable or readable. We use select here
177 In this example we are using the \f(CW\*(C`select\*(C'\fR function because it is very simple
183 while waiting for the socket state to change. But we don't use that timeout
190 connection has failed), or non-fatal (for example because we are trying to read
221 In our demo application we will write a function to handle these errors from
229 \& /* Temporary failure. Wait until we can read and try again */
234 \& /* Temporary failure. Wait until we can write and try again */
247 \& * If the failure is due to a verification error we can get more
264 might succeed (by using the \f(CWwait_for_activity()\fR function that we developed
269 In order to connect to a server we must create \fBSSL_CTX\fR and \fBSSL\fR objects for
271 on the \fBossl\-guide\-tls\-client\-block\fR\|(7) page. We won't repeat that information
275 As in the demo for a blocking TLS client we use the \fBSSL_connect\fR\|(3) function
276 to perform the TLS handshake with the server. Since we are using a nonblocking
278 error while we are waiting for the server to respond to our handshake messages.
279 In such a case we must retry the same \fBSSL_connect\fR\|(3) call at a later time.
280 In this demo we this in a loop:
293 Otherwise we use the \f(CWhandle_io_failure()\fR function that we created earlier to
294 work out what we should do next. Note that we do not expect an EOF to occur at
298 As with the blocking TLS client demo we use the \fBSSL_write_ex\fR\|(3) function to
299 send data to the server. As with \fBSSL_connect\fR\|(3) above, because we are using
309 blocking tutorial (\fBossl\-guide\-tls\-client\-block\fR\|(7)) we write the request
334 On a write we do not expect to see an EOF response so we treat that case in the
342 \& * Get up to sizeof(buf) bytes of the response. We keep reading until
360 \& * that it is NUL terminated so we use fwrite() to write the exact
361 \& * number of bytes that we read. The data could be non\-printable or
363 \& * we\*(Aqre going to print it to stdout anyway.
368 \& /* In case the response didn\*(Aqt finish with a newline we add one now */
376 In this demo we just print out all the data we've received back in the response
377 from the server. We continue going around the loop until we either encounter a
378 fatal error, or we receive an EOF (indicating a graceful finish).
381 As in the TLS blocking example we must shutdown the connection when we are
384 If our application was initiating the shutdown then we would expect to see
385 \&\fBSSL_shutdown\fR\|(3) give a return value of 0, and then we would continue to call
386 it until we received a return value of 1 (meaning we have successfully completed
387 the shutdown). In this particular example we don't expect \fBSSL_shutdown()\fR to
388 return 0 because we have already received EOF from the server indicating that it
389 has shutdown already. So we just keep calling it until \fBSSL_shutdown()\fR returns 1.
390 Since we are using a nonblocking socket we might expect to have to retry this
391 operation several times. If \fBSSL_shutdown\fR\|(3) returns a negative result then we
392 must call \fBSSL_get_error\fR\|(3) to work out what to do next. We use our
393 \&\fBhandle_io_failure()\fR function that we developed earlier for this:
397 \& * The peer already shutdown gracefully (we know this because of the
398 \& * SSL_ERROR_ZERO_RETURN (i.e. EOF) above). We should do the same back.
404 \& * ret == 0 is unexpected here because that means "we\*(Aqve sent a
405 \& * close_notify and we\*(Aqre waiting for one back". But we already know
406 \& * we got one from the peer because of the SSL_ERROR_ZERO_RETURN
415 As with the blocking TLS client example, once our connection is finished with we
417 blocking example, so we won't repeat it here.