Re: polling sockets using glib
- From: Soeren Sandmann <sandmann daimi au dk>
- To: Peter Robinson <pjr itee uq edu au>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: polling sockets using glib
- Date: 10 Oct 2006 20:48:54 +0200
Peter Robinson <pjr itee uq edu au> writes:
I am writing a server application (using glib) in which I want to be
able to (frequently) turn polling on and off for given sockets.
You may want to take a look at this:
http://www.daimi.au.dk/~sandmann/watch.h
http://www.daimi.au.dk/~sandmann/watch.c
It allows you to watch arbitrary pollable file descriptors by just
setting a callback. To turn off polling, you just set the callback to
NULL. Ie.,
To watch a descriptor:
fd_add_watch (fd, data);
To turn polling on:
fd_set_read_callback (fd, callback);
to turn polling off:
fd_set_read_callback (fd, NULL);
I have found it to be a more convenient API than the g_io_ stuff in
glib.
Soren
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]