Socket.setTimeout

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.

class Socket
void
setTimeout
(
uint timeout
)

Parameters

timeout uint

the timeout for @socket, in seconds, or 0 for none

Meta

Since

2.26