RE: problems with GIOChannel



W liście z czw, 08-05-2003, godz. 10:33, martyn 2 russell bt com pisze: 
No, to remove the watch, you return FALSE in the callback function, as
explained here:
http://developer.gnome.org/doc/API/2.0/glib/glib-IO-Channels.html#GIOFunc

I forgot about it. Does it mean that after I issue
g_io_channel_shutdown() function, my callback function will be notified
about it and I'll have a way to decide if I should return FALSE?

I did have a similar problem, I found that I was being notified that there
was input ready to read (via the g_io_channel_add_watch() callback) and was
reading the input, and that was fine.  In some instances (during early the
stages of development) I was trying to read MORE than was waiting for me on
the socket.  This mean't that the read function was waiting for more input
and the rest of the application stopped dealing with events until such time.

That's exactly my problem. Socket is waiting for input (^C in gdb says
it's in read function). I was just wondering why is the socket waiting
for more input, why does it allocate internal buffers when I pass my own
buffer to g_io_channel_read_chars. But it's not important right now
since GIOChannel's struct member "use_buffer" set to FALSE solves my
problem.

Also, just out of interest, have you thought about using gnet instead?? - I
moved over to it for cross-platform compatibility, it makes light work of
sockets and is fairly straight forward to use:
http://www.gnetlibrary.org/

No I haven't. I just took a look at the website. It seems to be based on
glib so using glib alone should do the same job with cross-platform
compatibility. But structers and functions used in gnet lib are
interesting and maybe I'll give it a try.

Thanks for a reply.
Pablo




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