### Virtual Method

# Gio DtlsConnection shutdown

since: 2.48

#### Declaration

    gboolean
    shutdown (
      GDtlsConnection* conn,
      gboolean shutdown_read,
      gboolean shutdown_write,
      GCancellable* cancellable,
      GError** error
    )

#### Description

Shut down part or all of a DTLS connection.

If `shutdown_read` is `TRUE` then the receiving side of the connection is shut down, and further reading is disallowed. Subsequent calls to `g_datagram_based_receive_messages()` will return `G_IO_ERROR_CLOSED`.

If `shutdown_write` is `TRUE` then the sending side of the connection is shut down, and further writing is disallowed. Subsequent calls to `g_datagram_based_send_messages()` will return `G_IO_ERROR_CLOSED`.

It is allowed for both `shutdown_read` and `shutdown_write` to be TRUE — this is equivalent to calling g_dtls_connection_close().

If `cancellable` is cancelled, the `GDtlsConnection` may be left partially-closed and any pending untransmitted data may be lost. Call `g_dtls_connection_shutdown()` again to complete closing the `GDtlsConnection`.

Available since: 2.48

#### Parameters

`shutdown_read`

  Type: `gboolean`

  `TRUE` to stop reception of incoming datagrams.

`shutdown_write`

  Type: `gboolean`

  `TRUE` to stop sending outgoing datagrams.

`cancellable`

  Type: `GCancellable`

  A `GCancellable`, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the virtual function if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gboolean`

`TRUE` on success, `FALSE` otherwise.