[gnet-dev] Problem with g_io_add_watch



Hi,

I am experiencing a problem, hope you might be able to help.

I add a watch to a channel using this code:

  g_io_add_watch (channel,
                  G_IO_IN | G_IO_PRI,
		                on_packet_recieved,
		                NULL);

Then I write some data to the same channel this way:

  gnet_io_channel_writen (channel, 
                          packet, 
                          actual_length, 
                          &actual_bytes_written);

(Natuarally, I also check for G_IO_ERROR_NONE)

This results in some strange behavior from the callback I added earlier.
It seems, as if data is ready to be read all the time, but when I read
the channel in the callback (using g_io_channel_read ()), there is no
data, and the function returns with G_IO_ERROR_NONE.

Can I not write to a channel which has a watch for incomming data?

Any ideas?
Any thoughts on this?
All help will be appreciated.


Sincerely,
-- 
Henrik Brix Andersen <btech1 users sourceforge net>

#include <std/disclaimer.h>





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