DatagramBasedT.conditionCheck

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.

%G_IO_IN will be set in the return value if data is available to read with g_datagram_based_receive_messages(), 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 g_socket_close() or g_socket_shutdown() with @shutdown_read set, if it’s a #GSocket).

If the connection is shut down or closed (by calling g_socket_close() or g_socket_shutdown() with @shutdown_read set, if it’s a #GSocket, for example), all calls to this function will return %G_IO_ERROR_CLOSED.

%G_IO_OUT will be set if it is expected that at least one byte can be sent using g_datagram_based_send_messages() without blocking. It will not be set if the datagram_based has been closed locally.

%G_IO_HUP will be set if the connection has been closed locally.

%G_IO_ERR will be set if there was an asynchronous error in transmitting data previously enqueued using g_datagram_based_send_messages().

Note that on Windows, it is possible for an operation to return %G_IO_ERROR_WOULD_BLOCK even immediately after g_datagram_based_condition_check() has claimed that the #GDatagramBased is ready for writing. Rather than calling g_datagram_based_condition_check() 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 %G_IO_ERROR_WOULD_BLOCK.

It is meaningless to specify %G_IO_ERR or %G_IO_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.

template DatagramBasedT(TStruct)
GIOCondition
conditionCheck
(
GIOCondition condition
)

Parameters

condition GIOCondition

a #GIOCondition mask to check

Return Value

Type: GIOCondition

the #GIOCondition mask of the current state

Meta

Since

2.48