On Tue, 03 Feb 2009 07:23:57 +0100 "Víctor M. Palacio Tárrega" <[email protected]> wrote: > The use in the second case is not clear. The socket file descriptor > is created with socket(), and is used with accept() to create a > connection to a client. My intention is to use a callback when a > client tries to connect to the server. > > Any help about this?
You have two main options. You can set the file descriptor returned by socket() non-blocking and poll it in the same way as you can poll the one returned by accept() (certainly you can do that with select() so I imagine you can do it with Glib::SignalIO which uses poll() under the hood). The callback will execute when there is a new connection pending and you can call accept() on the file descriptor and establish the client connection. This is the way you do it in single-threaded programs. Or you can have a separate thread which blocks on accept() and signals via Glib::Dispatcher that a client connection is available so far as you need to interact with GTK+. Chris _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
