Gio.Socket.set_timeout (original) (raw)

Method

GioSocketset_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 GSocketoperation 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 aftertimeout 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 withG_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

Parameters

timeout

Type: guint

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