Re: threaded network

> The simplest solution is to read a fixed number of bytes at a time, 
> then do the while(gtk_events_pending())gtk_main_iteration() trick (see
> FAQ) in between reads.
> Of course this breaks if the data stream is slow and you block during one
> of the reads. You could set a really short timeout on the socket or
> something to avoid this.

Wouldn't it be a lot easier/more reliable ot use a gdk_input handler
to call a callback when there actually is data ready, and to use a
non-blocking socket read?  (or whatever the equivalent glib
function is these days == of gdk_input_add) - sockets are fd's too.


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