Hi all,
Constructing a graphical server app, I'm using Glib::IOChannel in order
to have a callback when client data is ready to read on socket.
The problem is that sometimes I obtain a seg fault when calling function
IOChannel::read(char* buff, gsize len,gsize& readed). Gdb debugging says
that it's the seg violation is from IOChannel::read() function, not in
data postprocessing from my app code.
I workarounded it using ::read(...) instead (that sometimes also fails,
but do not seg faulting), and not processing data when reads .
Any ideas about it?
It looks like a bug in IOChannel for you, or I'm doing something really
nasty?
I'm doing collateral damage with my workaround, and you think it will
explode in my face later?
Regards,
Code:
int NetworkCommandManager::read_data(char* data, int len)
{
if (len>256){
std::cerr << "Cannot read more than 256 bytes" << std::endl;
return -1;
}
gsize n;
char buff[256];
std::cout<< "to read "<< len << " bytes" << std::endl;
n = ::read(read_fd,data,len); //workaround
//ioc_net->read(data,(gsize)len,n); //seg faulting call
std::cout<< "readed "<< n << " bytes" << std::endl;
if (n == len)
return 0;
else
return -1;
}
--
//*Víctor M. Palacio Tárrega*//
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list