Search code examples
csocketsgtkposix-select

New events with gtk+ (socket intercation with select)


I'm a real beginner in GTK+ programming, and I have trouble understanding the g_source_new() function.

I would like to handle my sockets using GTK events (new event when my socket is readable/writable, as using select).

What do I need to do?

PS: I don't want to use Gtk's socket management / creating a new thread for the UI.


Solution

  • GSource is poorly documented. The best you can do is browse the source and see how the timer and idle sources are implemented. Read the code of g_timer_add and g_idle_add.