Socket.setTimeout

void setTimeout(uint timeout)

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 [gio.types.IOErrorEnum.TimedOut].

On a non-blocking socket, calls to [gio.socket.Socket.conditionWait] will also fail with [gio.types.IOErrorEnum.TimedOut] after the given time. Sources created with [gio.socket.Socket.createSource] will trigger after timeout seconds of inactivity, with the requested condition set, at which point calling [gio.socket.Socket.receive], [gio.socket.Socket.send], [gio.socket.Socket.checkConnectResult], etc, will fail with [gio.types.IOErrorEnum.TimedOut].

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.

Parameters

timeoutthe timeout for socket, in seconds, or 0 for none