GSource* g_socket_create_source ( GSocket* socket, GIOCondition condition, GCancellable* cancellable )
GSource that can be attached to a %GMainContext to monitor
for the availability of the specified
condition on the socket. The
keeps a reference to the
The callback on the source is of the
It is meaningless to specify
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 g_cancellable_is_cancelled().
socket has a timeout set, and it is reached before
occurs, the source will then trigger anyway, reporting
G_IO_OUT depending on
socket will have been
marked as having had a timeout, and so the next
GSocket I/O method
you call will then fail with a
Available since: 2.22
This method is not directly available to language bindings.
A newly allocated %GSource, free with g_source_unref().
|The caller of the method takes ownership of the data, and is responsible for freeing it.|