create_source


Description:

public SocketSource create_source (IOCondition condition, Cancellable? cancellable = null)

Creates a SocketSource that can be attached to a gmaincontext to monitor for the availability of the specified condition on the socket.

The SocketSource keeps a reference to the this.

The callback on the source is of the SocketSourceFunc type.

It is meaningless to specify g_io_err or g_io_hup in condition ; these conditions will always be reported output if they are true.

cancellable if not null can be used to cancel the source, which will cause the source to trigger, reporting the current condition (which is likely 0 unless cancellation happened at the same time as a condition change). You can check for this in the callback using is_cancelled.

If this has a timeout set, and it is reached before condition occurs, the source will then trigger anyway, reporting g_io_in or g_io_out depending on condition . However, this will have been marked as having had a timeout, and so the next Socket I/O method you call will then fail with a g_io_error_timed_out.

Parameters:

this

a Socket

condition

a IOCondition mask to monitor

cancellable

a gcancellable or null

Returns:

a newly allocated gsource, free with g_source_unref.