<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE programlisting PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
]>
<!-- Automatically generated file.  Do not edit. -->
<programlisting language="C">
// Send the close_notify alert.
ret = SSL_shutdown(ssl);
switch (ret) {
case 1:
  // A close_notify alert has already been received.
  break;
case 0:
  // Wait for the close_notify alert from the peer.
  ret = SSL_shutdown(ssl);
  switch (ret) {
  case 0:
    fprintf(stderr, "info: second SSL_shutdown returned zero\n");
    break;
  case 1:
    break;
  default:
    ssl_print_error_and_exit(ssl, "SSL_shutdown 2", ret);
  }
  break;
default:
  ssl_print_error_and_exit(ssl, "SSL_shutdown 1", ret);
}
SSL_free(ssl);
close(sockfd);
</programlisting>
