### Method

# Gio Socket set_timeout

since: 2.26

#### Declaration [src]

    void
    g_socket_set_timeout (
      GSocket* socket,
      guint timeout
    )

#### Description [src]

Sets the time in seconds after which I/O operations on `socket` will time out if they have not yet completed.

On a blocking socket, this means that any blocking `GSocket` operation will time out after `timeout` seconds of inactivity, returning `G_IO_ERROR_TIMED_OUT`.

On a non-blocking socket, calls to `g_socket_condition_wait()` will also fail with `G_IO_ERROR_TIMED_OUT` after the given time. Sources created with `g_socket_create_source()` will trigger after `timeout` seconds of inactivity, with the requested condition set, at which point calling g_socket_receive(), g_socket_send(), g_socket_check_connect_result(), etc, will fail with `G_IO_ERROR_TIMED_OUT`.

If `timeout` is 0 (the default), operations will never time out on their own.

Note that if an I/O operation is interrupted by a signal, this may cause the timeout to be reset.

Available since: 2.26

Sets property | `Gio.Socket:timeout`

#### Parameters

`timeout`

  Type: `guint`

  The timeout for `socket`, in seconds, or 0 for none.