DatagramBased.conditionCheck
glib.types.IOCondition conditionCheck(glib.types.IOCondition condition)Checks on the readiness of datagram_based to perform operations. The operations specified in condition are checked for and masked against the currently-satisfied conditions on datagram_based. The result is returned.
[glib.types.IOCondition.In] will be set in the return value if data is available to read with [gio.datagram_based.DatagramBased.receiveMessages], or if the connection is closed remotely (EOS); and if the datagram_based has not been closed locally using some implementation-specific method (such as [gio.socket.Socket.close] or [gio.socket.Socket.shutdown] with shutdown_read set, if it’s a #GSocket).
If the connection is shut down or closed (by calling [gio.socket.Socket.close] or [gio.socket.Socket.shutdown] with shutdown_read set, if it’s a #GSocket, for example), all calls to this function will return [gio.types.IOErrorEnum.Closed].
[glib.types.IOCondition.Out] will be set if it is expected that at least one byte can be sent using [gio.datagram_based.DatagramBased.sendMessages] without blocking. It will not be set if the datagram_based has been closed locally.
[glib.types.IOCondition.Hup] will be set if the connection has been closed locally.
[glib.types.IOCondition.Err] will be set if there was an asynchronous error in transmitting data previously enqueued using [gio.datagram_based.DatagramBased.sendMessages].
Note that on Windows, it is possible for an operation to return [gio.types.IOErrorEnum.WouldBlock] even immediately after [gio.datagram_based.DatagramBased.conditionCheck] has claimed that the #GDatagramBased is ready for writing. Rather than calling [gio.datagram_based.DatagramBased.conditionCheck] and then writing to the #GDatagramBased if it succeeds, it is generally better to simply try writing right away, and try again later if the initial attempt returns [gio.types.IOErrorEnum.WouldBlock].
It is meaningless to specify [glib.types.IOCondition.Err] or [glib.types.IOCondition.Hup] in condition; these conditions will always be set in the output if they are true. Apart from these flags, the output is guaranteed to be masked by condition.
This call never blocks.
Parameters
condition | a #GIOCondition mask to check |