Re: Perl, GTK, Network

Mark Lehrer said:

What is the best strategy for handling the network in Gtk? Is there a
way to attach some kind of gtk signal handler to incoming network
traffic, or is it better to use some kind of threading?

use Glib::IO->add_watch to watch a file descriptor for input in the main loop:

here's the GLib function that this wraps:

and a Gtk2::Helper method exists to make that easier to use:

basically, the idea is that you have the main loop watch the file descriptor
for input, and tell the mainloop to call some function when there is input

this is a frequently asked question, but doesn't seem to appear in the gtk
faq...  it's been asked before:

muppet <scott at asofyet dot org>

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]