Re: [gtk-list] Re: GIOChannel



I presume you need to read the documentation for
	g_source_add
	g_main_add_poll
to do socket i/o in the gtk framework.

Assuming you always want to read or write if the fd is ready,
you call
	g_main_add_watch(channel,
	                 G_IO_IN or G_IO_OUT,
			 callback,
			 user_data);
with a callback which you want invoked whenever the fd is
ready.

If you don't want unconditional read/write you need
to write "prepare", "check" and "dispatch" functions--
see GSourceFuncs, the implementation in giounix.c,
or the "Main loop" documentation.

- Dave


On Wed, 19 Jan 2000, Sean Cody wrote:

> > The event model is critical for writing a gui which doesn't lock
> > up on all net requests.  I found it helpful enough that I've 
> > used it in at least one non-gui program -- my sound server, gdam.
> 
> How? Sustained transfers lock (on occation even if the socket is set to
> nonblocking) regardless if I use fd's or GIOChannel's. Is there something
> I'm missing(not seeing)? (I use a fair amount of reads and writes to a
> socket.  Aka getting all of the headers for all email waiting on a pop3
> server).
> 
> Sean Cody (aka NullStream) 
> umcodysw@cc.umanitoba.ca (SCHOOL)
> null@fuzyscsi.dhs.org     (HOME)
> 
> "If God's my witness then God must be blind."
> 	Garbage - As Heaven Is Wide
> 
> -- 
> To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
> 
> 



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