Re: [gtkmm] Problem with g_io_channel_read_chars



Martin Schulze wrote:

> Hi Andrew!
>
> I can't find any obvious problems in your code.
> It would be great if you could patch your program to not use the
> g_io_channel_* functions. (It should be no problem to use streams, e.g.)
> I'm asking for this because I initially wrote the signal_io() stuff and
> didn't test it with remote connections so I can't guarantee that there
> is no bug in gtkmm at this end. If your problems vanish with the
> g_io_channel_* functions it will be worth asking the gtk mailing list.

> >   g_io_channel_read_chars ( m_pChannel,
> >                             buffer,
> >                             sizeof(buffer),
> >                            &rsize,
> >                            &errcode) != G_IO_STATUS_NORMAL)
> >     {
>

Yes, you're right, there is nothing wrong with gtkmm, glibmm stuff.
Only one thing I would to ask about:
    show me an example, please, how to use streams to receive/send data
from/to
    sockets, and is there glibmm wrapping for g_io_channel_<> functions?

I've replaced that with:

    rsize = recv (m_FileDescriptor, buffer, sizeof(buffer), 0);

then got following error when tried to assign buffer to Glib::ustring:

(testtcp:25914): glibmm-CRITICAL **:
unhandled exception (type Glib::Error) in signal handler:
domain: g_convert_error
code  : 1
what  : Invalid byte sequence in conversion input

Looks like glib couldn't convert some of received data (russian koi8-r
symbols and control sequences) to internal Glib::ustring data format... What
is the way to let g_io_channel_read_<whatever> to drop control sequences
(that I am receiving when starting a telnet session) and convert
International symbols properly?
(g_io_channel_get_encoding() on my channel returns UTF-8 as should)

Well, it will be a shame to parse received data myself to drop those symbols
that made glib CRITICAL ;(.

-Andrew





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