Re: change condition on io_watch



Christoph Simon wrote:
Hi,

I'm trying to write a gtk+ program which is chatting with a server
while allowing the user to do other things. Initially I'm using
g_io_add_watch() which works fine while waiting for read and write
events. The problem is, that the server is always write-ready, thus,
even if I don't want to write anything yet, the callback is executed

if you do not want to write anything you should not watch if the channel
is ready for write.

A better solution would be to watch for read events only, and when you
want to write something change the watch to read+write, and when all
data is written, change it back again to watch only for read events.

regards,
        Olivier



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